webs.me.uk UK web hosting directory

HomeGuides → Migrating WordPress to a new host with no downtime

Intermediate 12 min read

Migrating WordPress to a new host with no downtime

Free managed migrations, plugin-based moves, and the manual method — plus the hosts file trick that lets you test the new site before touching DNS.

First: ask the new host to do it

Krystal, 20i, SiteGround, Kinsta, WP Engine, Cloudways, Nexcess and most others offer free migrations, and their team has done it a thousand times. Give them cPanel or SFTP credentials for the old host and let them. Only do it yourself if the site is unusual or you enjoy this sort of thing.

Route A: plugin migration

  1. On the new host, install a blank WordPress on a temporary URL.
  2. On the old site install Duplicator, All-in-One WP Migration or Migrate Guru and build a package.
  3. Import it into the new blank site. The plugin handles the database URL rewriting.
  4. Test thoroughly (see the hosts file trick below), then switch DNS.

Route B: the manual method

# On the old server
wp db export backup.sql
tar -czf files.tar.gz wp-content wp-config.php .htaccess

# Copy across
scp backup.sql files.tar.gz deploy@new-server:/tmp/

# On the new server
tar -xzf /tmp/files.tar.gz -C /var/www/example.com
wp db import /tmp/backup.sql

# Rewrite URLs safely (handles serialised data; --dry-run first)
wp search-replace 'http://old-domain.com' 'https://example.com' --skip-columns=guid --dry-run
wp search-replace 'http://old-domain.com' 'https://example.com' --skip-columns=guid

Never do the URL rewrite with a plain SQL find-and-replace. WordPress stores serialised PHP arrays in the options table, and a naive replacement corrupts them by breaking the recorded string lengths. wp search-replace understands this; sed does not.

Test before you switch DNS: the hosts file trick

Point your own machine at the new server while the rest of the world still sees the old one. Edit /etc/hosts (macOS/Linux) or C:\Windows\System32\drivers\etc\hosts (Windows, as Administrator):

203.0.113.45   example.com www.example.com

Now browse your real domain and you will hit the new server. Click through every template: home, a post, a category, search, the contact form, checkout if you have one, and the admin. Remove the line when done.

Cutting over cleanly

  1. Lower the TTL first. A day or two before the move, set the A record TTL to 300 seconds. Do this before the migration or the old TTL still applies.
  2. Freeze the old site. Stop publishing and, for shops, put the old site into maintenance mode so no orders land somewhere you are about to abandon.
  3. Re-sync the database right before the switch to capture last-minute comments and orders.
  4. Change the A/AAAA records to the new IPs.
  5. Reissue SSL on the new host once DNS resolves — Let's Encrypt validation needs the domain pointing at the new server.
  6. Leave the old host running for a week. Cancel only after you have confirmed traffic, forms, email and search rankings are healthy. The £10 is cheap insurance.

The things people forget

  • Email. If your MX records point at the old host's mail server, moving hosting can silently kill your email. Sort out mailboxes before, not after.
  • Cron jobs and scheduled tasks defined at the server level, not in WordPress.
  • Redirect rules living in .htaccess — nginx hosts ignore that file entirely and need the rules translated.
  • PHP version differences. An old site on PHP 7.4 moving to 8.3 may throw fatal errors from abandoned plugins. Test on staging.
  • Search Console. Nothing to change if the domain is the same, but watch crawl errors for a fortnight.