Locahl
Buy Locahl
WordPressmigrationhostinghosts fileDNS

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.

L

Locahl Team

Β·2 min read

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:

TEXT
203.0.113.50 example.com www.example.com

5. 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._

Also readTest a WordPress site before DNS propagation
Also readFix WordPress redirecting to the live site
Share this article
Available on Windows, macOS & 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
Buy Locahl β€” $5.99One-time payment, no subscription

Reader Reviews

4.7β˜…(3 reviews)
Marcus T.
β˜…β˜…β˜…β˜…β˜…

"Followed the hosts-file test step before switching DNS and migrated a busy WordPress store with no downtime."

June 13, 2026

Lucie F.
β˜…β˜…β˜…β˜…β˜…

"Clear end-to-end order. Testing on the new server with the real domain caught a broken plugin before go-live."

June 11, 2026

Devon K.
β˜…β˜…β˜…β˜…β˜…

"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

2 min read
WordPressDNSmigration

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.

L

Locahl Team

Developer tools team

2 min read
WordPressredirectmigration

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.

L

Locahl Team

Developer tools team

2 min read
localhost127.0.0.1DNS

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.

L

Locahl Team

Developer tools team

2 min read
DNSChrometroubleshooting

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.

L

Locahl Team

Developer tools team

2 min read
DNSMicrosoft Edgecache

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.

L

Locahl Team

Developer tools team