← All posts

Moving WordPress to a new host with no downtime: a step-by-step migration plan

How to move a WordPress site to a new hosting provider without losing orders, email or search rankings: the inventory to take first, the DNS setting to change days ahead, the copy, testing before the switch and what to watch afterwards.

Moving WordPress to a new host with no downtime: a step-by-step migration plan

Key points

  • A smooth migration starts days earlier: write down what is hosted where, and lower the DNS TTL in advance.
  • Test the new server completely before switching, using your hosts file: visitors see nothing until everything works.
  • Email is the first casualty of botched migrations: record your MX and TXT records before you touch the DNS zone.

Slow hosting, a price rise at renewal, support that has stopped answering, or a site that has simply outgrown its plan: there are plenty of good reasons to switch hosts. What holds most of our clients back is fear of downtime, and that fear is reasonable. On the migrations we get called in to rescue, the website itself is rarely what went wrong. It’s the email that stopped arriving, the contact form that silently fails, the orders placed mid-switch and lost, or the missing HTTPS certificate on launch morning. The good news is that a well-run WordPress migration can happen with no visible interruption at all. Here is the plan we follow, step by step, with the matching commands for anyone with SSH access. Every step also has an FTP and phpMyAdmin equivalent, or can be handled by a migration plugin.

Before you touch anything: take an inventory

Half of all migration incidents come from something nobody had written down. Before copying a single file, we put together a written inventory and go through it with the client:

  • Who runs what. The domain name (the registrar), the DNS zone, the website hosting and email can sit with four different companies, or all with the old host. The latter needs the most care: cancel the old plan and you may lose the domain or the mailboxes along with it.
  • Logins. Registrar, old host, new host and DNS provider credentials, plus SSH access on both sides if possible, or at least FTP and phpMyAdmin. Hunting for them on the day costs hours.
  • The technical environment. PHP version, MySQL or MariaDB version, PHP extensions in use (imagick, intl, gd…), memory and upload limits. The new server should be at least equivalent, ideally on the same PHP version for the move itself. Change one thing at a time; upgrade PHP afterwards.
  • Whatever runs in the background. System cron jobs, import scripts, automated backups, transactional email. None of it lives inside WordPress, so none of it travels with it.
  • Subdomains and side services: a shop. or staging. subdomain, an internal app, verification records for Google, Microsoft or your email marketing tool.

The inventory doubles as your checklist after the switch. On our projects it usually fits on one page, and it prevents the most common nasty surprise: finding out a week after cancelling the old hosting that it was also running the sales team’s email.

A few days ahead: get DNS ready

Switching hosts doesn’t change your site’s address, but it does change the server’s IP address. The DNS A record (and AAAA for IPv6) links the two. Every DNS resolver caches that answer for a period called the TTL. If the TTL is 24 hours, some visitors will keep reaching the old server for up to a day after you make the change.

The fix is simple but has to be planned: lower the TTL of the records involved to a few minutes (300 seconds is a common choice) at least one current TTL period before the move. With a 24-hour TTL, do it the day before at the latest. On the day, the switch then spreads within minutes, and so would a rollback.

# Current TTL (2nd column, in seconds) of the site's records
dig +noall +answer example.com A
dig +noall +answer www.example.com

# Who manages the DNS zone? (not necessarily the host)
dig +short NS example.com

# Where does email go? Write this down BEFORE moving anything
dig +short MX example.com
dig +short TXT example.com

While you’re there, record every entry in the zone, especially MX (mail servers) and TXT (SPF, DKIM, assorted verifications). If the DNS zone lives with the old provider and you’re moving it too, each of these must be recreated exactly at the new one, or email will stop arriving or start landing in spam.

Our advice: if you can avoid moving the DNS zone at the same time as the site, do. Editing one A record in a zone that stays put carries far less risk than rebuilding a whole zone. You can move the zone or transfer the domain later, once things have settled.

Copy the files and the database

A WordPress site is two things: files (core, theme, plugins and, above all, wp-content/uploads with your media) and a database (content, settings, users, orders). You copy both, then point wp-config.php at the new database credentials.

# --- On the old server ---
cd ~/www
wp db export ~/migration/db.sql --add-drop-table
wp core version; wp plugin list --status=active --fields=name,version
crontab -l > ~/migration/crontab.txt    # any scheduled jobs

# --- On the new server (SSH access to the old one) ---
rsync -avz --exclude='wp-content/cache/' oldhost:www/ ~/www/
rsync -avz oldhost:migration/ ~/migration/

cd ~/www
# Fill in DB_NAME, DB_USER, DB_PASSWORD, DB_HOST for the new host
nano wp-config.php
wp db import ~/migration/db.sql
wp option get siteurl                  # should show the usual address

A few things that catch people out regularly:

  • Hidden files. .htaccess (rewrite rules, redirects, security rules) is easy to miss in FTP clients that hide files starting with a dot. Without it, your permalinks return 404 errors.
  • Cache folders. There’s no point copying wp-content/cache; it rebuilds itself. Some caching plugins also write absolute paths into wp-config.php or advanced-cache.php, so check those if the site’s path differs on the new server.
  • Database encoding. Export and import as utf8mb4. An export from an old phpMyAdmin set to latin1 produces mangled accented characters, which the client usually spots on their home page.
  • Large sites. Once media runs to several gigabytes, forget downloading everything to your laptop and re-uploading over FTP. A direct server-to-server copy with rsync is faster and can be resumed: it only transfers what changed.

If the domain or protocol changes during the move (http to https, a new domain, a site moved from a subfolder to the root), the old addresses stored in the database need replacing too. Never do that with a SQL REPLACE query or a text editor: WordPress and many plugins store serialized data that records each string’s length, and a blind replace corrupts it. WP-CLI handles this correctly:

# Only if the address or path changes (new domain, http -> https…)
wp search-replace 'http://old-domain.com' 'https://example.com' --all-tables --dry-run
wp search-replace 'http://old-domain.com' 'https://example.com' --all-tables

# Then
wp rewrite flush
wp cache flush

If the address isn’t changing, which is the case for a plain change of host, skip this step entirely. There’s nothing to replace.

Test the new server before anyone else sees it

This step is what separates a calm migration from a long, sweaty evening. At this point DNS still points at the old server, so visitors see nothing. That means you can force just your own computer to use the new server by adding one line to your hosts file:

# Hosts file : /etc/hosts (macOS, Linux)
# or C:WindowsSystem32driversetchosts (Windows, editor run as administrator)
203.0.113.10   example.com www.example.com

# Or, without editing the hosts file, from the command line:
curl -sI --resolve example.com:443:203.0.113.10 https://example.com/ | head -n 5

Replace 203.0.113.10 with the new server’s IP address. Remember to remove the line after the switch, and clear your browser’s DNS cache if the change doesn’t seem to take. Then browse the site as a visitor, and again as an administrator. Our checklist:

  • the home page, a few posts, category archives (if permalinks return 404, it’s nearly always .htaccess or the Nginx configuration);
  • logging into the dashboard, uploading an image, saving a post;
  • every form, with a real submission and the email actually received. This is what breaks most often, because the new server isn’t yet authorised to send mail for your domain (the SPF record);
  • for a shop: a full checkout using the payment provider’s test mode, and payment notifications (webhooks). Those are sent to the public address, so at this stage they still reach the old server;
  • the new host’s PHP error logs: a plugin that ran cleanly on PHP 8.1 can throw errors on a different version.

That leaves the HTTPS certificate. Free Let’s Encrypt certificates are usually issued once the host has checked that the domain points to its server, which isn’t true yet. You have three options: the host offers DNS validation (a TXT record), you temporarily install an existing certificate, or you accept a window of a few minutes after the switch while the certificate is issued. For testing beforehand, curl with -k or clicking through the browser warning is fine. What matters is knowing in advance how the certificate will be obtained, rather than discovering it on the day.

On the day: freeze, sync, switch

Between the first copy and the switch, the site has carried on: new posts, comments, orders, sign-ups. The final sync brings those changes across. For a brochure site that rarely changes, simply agreeing not to publish anything for a few hours is enough. For a shop or a members’ site you need to freeze writes, otherwise an order placed on the old server during DNS propagation would be lost.

# --- Old server: freeze all writes ---
wp maintenance-mode activate
wp db export ~/migration/db-final.sql --add-drop-table

# --- New server: final sync ---
rsync -avz oldhost:www/wp-content/uploads/ ~/www/wp-content/uploads/
rsync -avz oldhost:migration/db-final.sql ~/migration/
wp db import ~/migration/db-final.sql
wp cache flush

# --- Then: change the A record (and www) at your DNS provider ---
# and check propagation on several public resolvers
dig +short example.com A @1.1.1.1
dig +short example.com A @8.8.8.8

Pick your moment: outside your business’s peak hours, and never on a Friday evening when nobody will be around to fix something that was missed. Maintenance mode on the old server only lasts as long as the export and import; for a typical site that’s a matter of minutes.

Once the A record has changed, your hosts file stops telling you anything useful. Remove the line you added and use the dig commands above to confirm that public resolvers return the new address. Keep an eye on the old server’s access log: once visits stop arriving there, propagation is done.

Plan the rollback too. Thanks to the short TTL, putting the old IP address back in the zone sends visitors to the old server within minutes, provided it’s still running and you turn its maintenance mode off. That’s exactly why you never cancel the old hosting on migration day.

After the switch: monitor, and don’t cancel anything too soon

For the first few hours, run through the checklist again, this time on the live site. Then keep watching for a few days:

  • Email: send yourself a message from every form and make sure it doesn’t land in spam. If the new server sends mail itself, add it to your SPF record; better still, route mail through a dedicated SMTP service that doesn’t depend on your host.
  • Scheduled tasks: recreate the cron jobs from your inventory. If WordPress publishes scheduled posts or sends reminders, check they actually go out.
  • Google Search Console: the crawl stats and indexing reports shouldn’t show a spike in server errors or 404s. A change of host at the same address has no effect on rankings, as long as the site responds as well as before.
  • Backups: the old host’s backups no longer protect you. Make sure the new host’s backups are running, and do a test restore within the first few weeks.
  • Performance: compare response times with the measurements you took before the move. If the new server is slower, now is the time to raise it with the host, not three months down the line.

Keep the old hosting live until the monitoring period is over, and take a full backup from it before cancelling. Check one last time that neither the domain nor the mailboxes are tied to that account. That’s the one mistake you can’t always undo.

FAQ

Will changing hosts hurt my search rankings?

No, provided page addresses stay the same and the site remains reachable throughout. Google just sees a new IP address. The risk comes from prolonged downtime, a slower server, or pages throwing errors after the move. Changing your domain or URL structure at the same time is a different project, and needs a 301 redirect plan.

Is a migration plugin enough?

For a small site, often yes: migration plugins automate the copy and the address replacement. They don’t deal with DNS, email, cron jobs, certificates or freezing orders, though. They replace the copy step, not the rest of the plan. On large sites they also run into the execution time limits of shared hosting.

How long will the site be offline?

With this approach, a brochure site has no downtime at all: the old server keeps answering until every visitor has moved over to the new one. For a shop, the only visible part is the order freeze during the final sync. How long that takes depends on the amount of data, which is exactly why you time it during the first copy.

Should I transfer the domain at the same time?

We advise against it. Moving a domain between registrars is a separate procedure that can take several days, and it shouldn’t be stacked on top of moving the site. Do it before or after, once the migration has settled.

Thinking of switching hosts, or dealing with a migration that went wrong? We plan and carry out complete WordPress migrations, including DNS, email and post-launch checks. Let’s talk about your site.

Share LinkedIn Facebook X WhatsApp
</>

webtestudio

Web agency: custom WordPress sites, premium themes and SaaS software.

Discuss your project →