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.
Sleezr Team

Table of Contents
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
203.0.113.50 example.com www.example.comhttps://example.com and test pages, login, checkout, and media.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.
Some installs also pin the URL with the WP_HOME and WP_SITEURL constants in wp-config.php. The hosts file method works either way: because you keep the real domain for the whole staging test, there is no constant to change and no temporary URL to search-replace.
Verify you are hitting the new server
nslookup example.comIt 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. Sleezr 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._
Sources and further reading
- Official WordPress documentation
- How DNS works (Cloudflare Learning)
- The hosts file explained (Wikipedia)
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
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.
Sleezr 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.
Sleezr Team
Developer tools team
/etc/hosts Not Working? Fixes for Windows, Mac & Linux
The hosts file is ignored or /etc/hosts changes do not take effect? Fix it on Windows, Mac and Linux: flush DNS, check syntax, IPv6, line endings, resolver caches and save permissions.
Sleezr 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.
Sleezr Team
Developer tools team
Which TLD to Use for Local Development (.test vs .localhost)
Which TLD to use for local development: prefer .test, avoid .dev and .local. Why .test is reserved, how to map it in the hosts file, and HTTPS tips.
Sleezr Team
Developer tools team