RBRunbook
Dev Tools

How to Migrate a WordPress Site to a New Host Without Downtime

The trick to a zero-downtime migration is that your old site keeps serving visitors right up until DNS finishes switching — here's the exact sequence.

DifficultyIntermediate
Time1–2 hours
PlatformAny host
CategoryDev Tools

The most common way WordPress migrations cause downtime is switching DNS before confirming the new host actually works. Done in the right order, visitors keep hitting your old, working site the entire time you're setting up and testing the new one — they only get switched over once everything is confirmed working.

01Export the database

Via phpMyAdmin on your old host, or with WP-CLI if you have shell access:

wp db export backup.sql

02Copy all site files

Download the entire wp-content folder (themes, plugins, uploads) plus wp-config.php via SFTP, or use a plugin like Duplicator/All-in-One WP Migration if you don't have direct file access.

03Set up the new host — but don't touch DNS yet

  1. Create the database on the new host and import your backup.sql.
  2. Upload your site files.
  3. Update wp-config.php with the new database name, username, password, and host.

04Test the new host using a hosts file override

This is the step that makes zero-downtime possible: point your own computer at the new server without changing DNS for anyone else.

Add a line: [new server IP] yourdomain.com. Save, flush your DNS cache (ipconfig /flushdns on Windows, sudo dscacheutil -flushcache on macOS), and visit your site. Only your computer sees the new server — everyone else still hits the old one, unaffected.

05Thoroughly test the new site while it's still hidden

Check every page template, contact forms, checkout flow if it's a store, image loading, and the admin dashboard. Fix anything broken now, while there's zero visitor impact.

06Lower your DNS TTL a day in advance

If you can, lower your DNS record's TTL (time-to-live) to 300 seconds a day before the actual switch. This makes the eventual real DNS change propagate in minutes instead of up to 48 hours.

07Switch DNS, then remove your hosts file override

Once you're confident, update your domain's A record to point at the new server. Remove the line you added to your hosts file — you want to see the site the same way real visitors now do, to confirm the live switch worked.

Don't cancel the old host immediately Keep the old hosting account active for at least a week after switching. DNS changes don't reach every visitor instantly — some ISPs cache DNS longer than they should, and a small percentage of traffic may still hit the old server for a few days.
JM
Written by Jordan Malik Senior Editor, Systems & Networking — guide tested on a live Any host setup before publishing
Last verified: July 2026