
Migrate WordPress to a New Server With No Downtime
Migrate WordPress to a new host with zero downtime: copy files and database, test on the new server via the hosts file before DNS, then switch and clean up.
Manage hosts files without the terminal
ToggleHosts helps you manage environments visually on Windows, macOS, and Linux, with automatic DNS flush and backups.
One-time payment
The key to a zero-downtime WordPress migration is to fully test the new server before you change DNS, using the hosts file to preview the site under its real domain. You copy everything to the new host, verify it locally with the live URL, and only then flip DNS. Visitors keep hitting the old server until the new one is proven good.
Migrate WordPress to a new server with no downtime
- Lower your DNS TTL (e.g. to 300s) a day or two before the move.
- Copy files to the new server (SFTP, rsync, or a migration plugin).
- Export and import the database, keeping the same domain in
siteurl/home. - Map the domain to the new server in your hosts file:
203.0.113.50 example.com www.example.com- Flush DNS, on Mac or on Windows.
- Test thoroughly on the new server with the real domain: pages, login, forms, checkout, media, plugins.
- Switch DNS at your registrar to the new server IP.
- Remove the hosts entry and flush DNS so you follow real propagation.
Why test with the hosts file (not the IP)
WordPress stores its address in the database, so browsing the new server by IP redirects back to the live domain, you would test the old site by mistake. The hosts file makes WordPress serve the new server under its true URL. Full walkthrough: test a WordPress site before DNS propagation.
Don’t forget
- Email / MX: web hosting and email are separate; confirm MX records.
- SSL: issue the certificate on the new server before go-live to avoid warnings.
- Caching/CDN: purge caches after the switch.
- wp-config.php: if
WP_HOME/WP_SITEURLare hard-coded there, keep them on the real domain, the hosts-file test covers the staging phase without changing them. - Search-replace: only if you intentionally change the domain, not needed for a same-domain move.
For the broader, CMS-agnostic version, see test a website before DNS migration.
Keep cutovers clean and repeatable
Hand-editing the hosts file for each migration invites mistakes: a typo in the IP, a missing www, or a temporary entry left behind that makes you "see the old site" for days. ToggleHosts stores migration entries in a dedicated environment you toggle on to test and off after go-live, flushing DNS automatically, so every WordPress move is clean and repeatable.
_Last tested: June 2026 on Windows, macOS and Linux._
Sources and further reading
- Official WordPress documentation
- How DNS works (Cloudflare Learning)
- The hosts file explained (Wikipedia)
Frequently Asked Questions
Copy files and the database to the new server, test it there using the hosts file (mapping the real domain to the new IP) before changing DNS, then switch DNS once verified. Visitors never hit a broken site.
Add a hosts entry pointing your domain to the new server IP, flush DNS, and browse the site. Only your machine sees the new server until you change DNS.
Yes. Lowering the TTL a day or two before the move shortens propagation time so the cutover is faster.
Migrate or confirm MX records separately. Moving web hosting does not move email unless your MX records point to the same provider.
Related Articles
Test a WordPress Site Before DNS PropagationWordPress
Test a WordPress Site Before DNS Propagation
3 min read
Fix WordPress Redirecting to the Live SiteWordPress
Fix WordPress Redirecting to the Live Site
3 min read
Fix ERR_TOO_MANY_REDIRECTS with Hosts File (2026)Troubleshooting
Fix ERR_TOO_MANY_REDIRECTS with Hosts File (2026)
3 min read