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.
Locahl Team
Table of Contents
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
1. Lower your DNS TTL (e.g. to 300s) a day or two before the move. 2. Copy files to the new server (SFTP, rsync, or a migration plugin). 3. Export and import the database, keeping the same domain in siteurl/home. 4. Map the domain to the new server in your hosts file:
203.0.113.50 example.com www.example.com5. Flush DNS β on Mac or on Windows. 6. Test thoroughly on the new server with the real domain: pages, login, forms, checkout, media, plugins. 7. Switch DNS at your registrar to the new server IP. 8. 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.
- 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. Locahl 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._
Ready to simplify your workflow?
Stop wasting time with the terminal. Locahl lets you manage your hosts file in a few clicks, with automatic validation and no risk of errors.
- Intuitive visual interface
- Automatic DNS flush
- Multi-environment management
- Automatic backups
- JSON Import/Export
Reader Reviews
"Followed the hosts-file test step before switching DNS and migrated a busy WordPress store with no downtime."
June 13, 2026
"Clear end-to-end order. Testing on the new server with the real domain caught a broken plugin before go-live."
June 11, 2026
"Great checklist. Would add a note on lowering TTL before the move."
June 9, 2026
Frequently Asked Questions
How do I migrate WordPress with no downtime?
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.
How do I test the new server before switching DNS?
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.
Should I lower the DNS TTL before migrating?
Yes. Lowering the TTL a day or two before the move shortens propagation time so the cutover is faster.
What about email during a WordPress migration?
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 Propagation
Preview and test a WordPress site on a new server before DNS propagation using the hosts file. Map your real domain to the new IP, verify, then switch DNS safely.
Locahl Team
Developer tools team
Fix WordPress Redirecting to the Live Site
WordPress redirects to the live site when testing on a new server because the URL is hard-coded in the database. Fix it with the hosts file β no DB edits needed.
Locahl Team
Developer tools team
127.0.0.1 vs localhost: Whatβs the Difference?
127.0.0.1 vs localhost explained: both point to your machine, but they differ in DNS resolution, IPv6, and hosts file behavior. When to use each, with examples.
Locahl Team
Developer tools team
Fix DNS_PROBE_FINISHED_NXDOMAIN (2026)
Fix DNS_PROBE_FINISHED_NXDOMAIN in Chrome and Edge: flush DNS, check the hosts file, reset DNS servers and clear the browser cache. Step-by-step solutions.
Locahl Team
Developer tools team
Clear DNS Cache in Microsoft Edge (2026)
Clear the DNS cache in Microsoft Edge with edge://net-internals/#dns, flush socket pools, and clear the Windows DNS cache so hosts changes take effect.
Locahl Team
Developer tools team