Skip to main content

Migrating WordPress to HostingSwift

Move a WordPress site — files, database and URLs — without broken images or lost posts.

WordPress migrations go wrong in predictable ways. Handle these and it is routine.

Prepare

  1. Back up the current site completely — files and database. See Database backups.

  2. Note the plugins and theme, and any custom wp-config.php constants.

  3. Check the PHP version on the old host so you match or exceed it.

  4. Export the database:

bash
wp db export backup.sql --path=/var/www/html   # if WP-CLI is available
# or
mysqldump --single-transaction wordpress_db > backup.sql

Copy the files

bash
rsync -avz --delete /var/www/html/ user@newhost:/var/www/html/

Or use a migration plugin if you prefer a GUI. Either way, the database is the part that needs care.

Import the database

bash
mysql new_db < backup.sql

Update wp-config.php with the new database name, user and password.

Fix the URLs — the step everyone forgets

WordPress stores absolute URLs in the database. If the domain changes, every image and link may still point at the old domain. Fix it properly:

bash
wp search-replace 'https://old.example' 'https://new.example' --all-tables --precise

Without WP-CLI, use a serialised-data-aware search-replace plugin — a plain SQL REPLACE corrupts serialised PHP arrays and can quietly break your theme options.

Test thoroughly

  • Homepage, a single post, a category archive.

  • Images (the most common casualty).

  • Login and admin.

  • Forms, and the email they send.

  • Permalinks (Settings → Permalinks → Save, to flush rewrite rules).

Cut over

Lower the TTL, point DNS at the new host, then restore the TTL. See Migrating your hosting.

After the move

  • HTTPS — issue a certificate and force the redirect; see Free TLS certificates.

  • Caching — add a page cache, the biggest speed win; see WordPress performance.

  • Search-engine settings — make sure nothing is set to noindex from a staging setup.

  • Keep the old host for a few days as rollback, then cancel.

Related reading