đź§ How to Preview a Migrated Website Without Changing DNS #
If you’ve just migrated a website and want to preview it before updating DNS records, you can override DNS resolution locally using the file. This method works on Windows, Linux, and macOS.
🛠️ Step 1: Get the New Server’s IP Address #
You’ll need the public IP address of the new server.
Example:
203.0.113.42 www.example.com
🧑‍💻 Step 2: Modify the Hosts File #
🪟 Windows: #
1. Open Notepad as Administrator
• Click Start → search for “Notepad”
• Right-click → “Run as administrator”
2. Open the hosts file
Navigate to:
C:\Windows\System32\drivers\etc\hosts
3. Set file type to “All Files” to see it.
4. Add your override at the bottom:
203.0.113.42 www.example.com
Important
Replace the IP and domain for your domain and your server's domain IP
5. Save the file and close Notepad.
6. Flush DNS cache (optional but recommended):
Open Command Prompt as admin and run:
ipconfig /flushdns