Locahl
Buy Locahl
WordPressDNSmigrationhosts filestaging

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

·2 min read

To test a WordPress site before DNS propagation, map the real domain to the new server’s IP in your hosts file. Your computer then loads the new server using the live domain name, while everyone else still sees the old site. This is the safest way to verify a WordPress migration with the real URL — no database edits, no downtime.

How to test WordPress before DNS propagation

1. Get the new server’s IP address from your host. 2. Open the hosts file and add the domain (and www):

TEXT
203.0.113.50 example.com www.example.com

3. Save the file — see edit the hosts file on Windows or on Mac. 4. Flush DNS so the change applies — on Windows or on Mac. 5. Open https://example.com and test pages, login, checkout, and media. 6. When everything works, change the real DNS at your registrar, then remove the hosts entry and flush DNS again.

Why the raw IP does not work for WordPress

WordPress hard-codes the site address in the database (siteurl and home in wp_options). If you visit the new server by IP, WordPress redirects you back to the live domain — so you end up testing the *old* server. Mapping the real domain in the hosts file makes WordPress serve the new server under its own URL, exactly as it will after the switch.

Verify you are hitting the new server

TEXT
nslookup example.com

It should return the new IP from your machine only. You can also drop a temporary marker file on the new server and confirm it loads. For a deeper checklist, see test a website before DNS migration.

Clean up after go-live

Leftover migration entries are the #1 cause of "I see the old site" confusion later. After DNS is switched, delete the temporary line and flush DNS so you resolve through real DNS like your visitors.

Make migrations painless

Editing the hosts file by hand for every client migration is error-prone — wrong IP, forgotten www, or a stale entry left behind. Locahl keeps migration entries in a separate environment you can toggle on for testing and off after go-live, and it flushes DNS automatically, so WordPress cutovers stay clean.

_Last tested: June 2026 on Windows, macOS and Linux._

Also readTest a website before DNS migration
Also readMigrate WordPress to a new server with no downtime
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)
Sandra M.

"Mapped my domain to the new host IP and tested the whole WordPress site before switching DNS. Zero downtime."

June 13, 2026

Wesley T.

"This is the only reliable way to preview WordPress with the real domain. Saved my client migration."

June 11, 2026

Inés D.

"Worked great. A reminder to remove the entry after go-live would help beginners."

June 9, 2026

Frequently Asked Questions

How do I test a WordPress site before DNS propagation?

Add a line to your hosts file mapping the real domain to the new server IP (e.g. 203.0.113.50 example.com www.example.com), flush DNS, then open the site. Your machine reaches the new server while the rest of the world still sees the old one.

Why can’t I just use the new server’s IP in the browser?

WordPress stores the site URL in the database (siteurl/home), so visiting the raw IP usually redirects you back to the live domain. Mapping the real domain in the hosts file avoids that.

Do I need to edit the database to preview WordPress?

No. The hosts file method lets you preview with the real domain without touching wp_options, so no temporary URL changes or search-replace are needed.

What do I do after the site looks correct?

Update DNS to the new server, then remove the temporary hosts entry and flush DNS so you follow real propagation like everyone else.

Related Articles

2 min read
WordPressmigrationhosting

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

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

11 min read
QA testingstaginghosts file

Hosts Files for QA and Staging Testing

Guide for QA teams testing staging environments before DNS propagation, with hosts file workflows and team collaboration tips.

L

Locahl 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