Test a website before DNS migration: method + checklist (2026)
How to test your new server before changing DNS? Hosts file method, SSL verification, complete checklist for zero-downtime migration.
Locahl Team
Table of Contents
- Why test before migration?
- Risks of direct migration
- The hosts file advantage
- Step 1: Get the new server's IP
- At common hosts
- Step 2: Modify the hosts file
- On Mac
- On Windows
- Flush DNS cache
- Step 3: Tests to perform
- Basic test
- Verify you're on the right server
- Complete test checklist
- Step 4: Verify SSL certificate
- Visual verification
- Certificate verification
- Common SSL problems
- Step 5: Proceed with DNS migration
- Check propagation
- Step 6: Post-migration cleanup
- Remove hosts entries
- Flush DNS cache one last time
- Verify everything works
- Special cases
- Migration with CMS change
- E-commerce migration
- Sites with CDN (Cloudflare)
- Automate with Locahl
- Complete migration checklist
- Before migration
- During tests
- After DNS migration
- Conclusion
Migrating a website to a new server is always stressful. What if something doesn't work? What if the site is inaccessible for hours? The solution: test your new server BEFORE changing DNS, using the hosts file.
Why test before migration?
Risks of direct migration
- Downtime: If the new server has a problem, your site is down
- SSL Certificate: Let's Encrypt can fail if misconfigured
- Server configuration: PHP version, missing modules, .htaccess...
- Database: Connections, performance, corrupted data
- Paths and links: Hardcoded URLs, absolute paths
The hosts file advantage
By modifying your hosts file, you point the domain to the new server only on your machine. The rest of the world continues accessing the old server.
Result: you can test for hours without impacting your users.
Simplify your hosts file management
Locahl lets you manage your hosts file visually, without touching the terminal. Automatic DNS flush, multiple environments, and backups included.
Step 1: Get the new server's IP
Connect to your new server/host and note the IP address.
At common hosts
SiteGround / Bluehost
- cPanel > Server Information > IP Address
Cloudways / DigitalOcean
- Dashboard > Server > IP Address
AWS / GCP
- Instance > Public IP
Netlify / Vercel
- Deploy settings > Domain settings
Step 2: Modify the hosts file
On Mac
sudo nano /etc/hostsAdd at the end:
# Temporary migration - DELETE after migration
203.0.113.50 www.mysite.com
203.0.113.50 mysite.comReplace 203.0.113.50 with your new server's IP.
On Windows
1. Open Notepad as administrator 2. File > Open > C:\Windows\System32\drivers\etc\hosts 3. Add the same lines
Flush DNS cache
Essential after modification:
# Mac
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
# Windows
ipconfig /flushdnsStep 3: Tests to perform
Basic test
1. Open your browser in private/incognito mode 2. Go to https://www.mysite.com 3. The site should display from the new server
Verify you're on the right server
Create a temporary test file on the new server:
echo "NEW SERVER" > /var/www/html/test-migration.txtThen access https://www.mysite.com/test-migration.txt
Don't forget to delete this file afterwards!
Complete test checklist
Pages and navigation
- [ ] Homepage
- [ ] Internal pages (at least 5)
- [ ] Contact forms
- [ ] Login/signup pages
Features
- [ ] Internal search
- [ ] Cart / e-commerce
- [ ] Member area
- [ ] API / endpoints
Media
- [ ] Images display
- [ ] Videos play
- [ ] PDFs downloadable
- [ ] Uploads work
Performance
- [ ] Acceptable load time
- [ ] No 500/503 errors
- [ ] Cache works
Step 4: Verify SSL certificate
This is crucial. A misconfigured certificate = site inaccessible via HTTPS.
Visual verification
- Green padlock in address bar
- No security warning
Certificate verification
Click the padlock > Certificate > Verify:
- Correct domain
- Validity date
- Issuer (Let's Encrypt, Sectigo, etc.)
Common SSL problems
"NET::ERR_CERT_COMMON_NAME_INVALID" The certificate isn't issued for this domain. Regenerate it.
"Certificate expired" The certificate wasn't renewed on the new server.
Step 5: Proceed with DNS migration
Once all tests pass:
1. Connect to your registrar (GoDaddy, Namecheap, Cloudflare...) 2. Modify the A records to point to the new IP 3. Wait for propagation (minutes to 48h depending on TTL)
Check propagation
Use whatsmydns.net to see global status.
Step 6: Post-migration cleanup
Remove hosts entries
Once propagation is complete:
sudo nano /etc/hostsDelete the lines added for migration.
Flush DNS cache one last time
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponderVerify everything works
Test from another device (phone on cellular) to confirm the new server is responding.
Special cases
Migration with CMS change
If migrating WordPress to another CMS, also test:
- 301 redirects from old URLs
- Updated XML sitemap
- Internal links functional
E-commerce migration
Additional critical points:
- Payment gateways
- Webhooks (Stripe, PayPal)
- Transactional emails
- Stock and pending orders
Sites with CDN (Cloudflare)
If using Cloudflare: 1. Cloudflare proxy uses its own IPs 2. Test in "DNS only" mode (grey cloud) 3. Re-enable proxy after validation
Automate with Locahl
To easily manage these temporary hosts modifications:
- Create a "Migrations" group
- Enable/disable with one click
- Modification history
- No risk of syntax errors
Complete migration checklist
Before migration
- [ ] Full backup of current site
- [ ] Note new server IP
- [ ] SSL configured on new server
- [ ] Current DNS with reduced TTL (300s)
During tests
- [ ] Hosts file modified
- [ ] DNS cache flushed
- [ ] All tests passed
- [ ] SSL certificate validated
After DNS migration
- [ ] Propagation verified
- [ ] Site accessible everywhere
- [ ] Hosts entries removed
- [ ] Old server kept 7 days (backup)
Conclusion
Testing before migrating is the key to stress-free migration. The hosts file gives you a perfect test environment, invisible to your users. Take time to verify everything before changing official DNS.
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
"This method saved me from a failed migration. I was able to identify an SSL certificate issue before switching."
July 30, 2025
"The checklist at the end is perfect. I now use it for all my client migrations."
September 18, 2025
"Very useful. Would have liked more details on CDN migrations but otherwise excellent."
December 10, 2025
Frequently Asked Questions
How do I test a website on a new server before changing DNS?
Modify your hosts file to point the domain to the new server's IP. Only you will see the new site, other users will continue accessing the old one.
Do SSL certificates work with the hosts file method?
Yes, if the certificate is correctly installed on the new server. Your browser will verify the certificate normally.
How long before I can remove the hosts entries?
Wait for complete DNS propagation, typically 24-48h. Check with tools like whatsmydns.net before removing entries.
Can I test emails with this method?
Emails aren't affected by the hosts file. They follow MX records in DNS. Test them separately after DNS migration.
What if the site doesn't work on the new server?
That's the advantage of this method: simply remove the hosts entry and flush DNS cache. You instantly return to the old server.
Related Articles
Terminal vs GUI: Why Developers Are Switching to Hosts File Apps
Compare editing hosts file via Terminal vs using Locahl GUI. Learn about permission issues, typo risks, backups, DNS flush, and why GUI hosts file managers are better for developers.
Locahl Team
Hosts File Not Working After Edit on Mac: Complete Fix Guide
Your hosts file changes not taking effect? Learn how to fix DNS cache issues, browser cache, file permissions, syntax errors, and encoding problems on macOS.
Locahl Team
How to Manage Multiple Hosts Files for Different Projects
Learn how to manage different hosts file configurations for dev, staging, and production environments. Switch between project setups, version control hosts configs, and streamline team workflows.
Locahl Team