[ADVANCED] Edit Windows `hosts` File to Preview Content
Print
165
Need to preview your site on a new server before DNS propagates? Here is the best method (assuming you are running Microsoft Windows):
In some versions of Windows XP or below, go to Start -> Programs -> Accessories and click "notepad" or in Windows 7, Vista, right click notepad and "Run As Administrator")
In notepad, go to file -> open and put in filename: c:\windows\system32\drivers\etc\hosts
Add the following lines to the BOTTOM of that file:
(replace xxx.xxx.xxx.xxx with the IP address of the new server and "yourdomain.com" with the actual domain name you want to preview)
Save the file - keep the window open
In some versions of Windows XP or below, go to Start -> Programs -> Accessories and click "Command Prompt" or in Windows 7, Vista, right click Command Prompt and "Run As Administrator")
Type:
ipconfig /flushdns
Once you are done with that try pinging any of the domains. They should respond from the new IP:
================= ping www.yourdomain.com
Reply from xxx.xxx.xxx.xxx =================
If you see that, your computer has been fooled into seeing the domains on the new server, while the rest of the world sees the old server. You should then exit all open browers, clear cookies/cache, and then re-open your webbrowser and test the domains. Please report any problems to us.
Once you are done testing, to return to normal, go back into the window with the "hosts" file and remove all of the lines with the IP addresses and hostnames that you added (but leave 127.0.0.1). Run the ipconfig /flushdns command again and re-ping the sites to make sure you see the old IP. That way, when you transfer DNS and change the A records on the old server, you can accurately tell when it has propagated.