Overcome DNS Propagation Time with Hosts File Hacks
When you decide to host a site yourself, the usual routine is this:
01. Copy your site through ftp to your server
02. Prepare the emails.
03. Prepare your database and user.
04. Point the DNS servers of the domain to your server.
Unfortunately, DNS propagation recommends at least fourty-eight hours (two days) before the changes are seen by all regular visitors. Developers won’t be productive for two days. Fortunately, we can quicken the propagation process with the hosts file.
For Windows, you’ll find the hosts file under %SystemRoot%\system32\drivers\etc\hosts where %SystemRoot% is usually WINDOWS.
Because we can manually map an IP to a hostname, we can add an entry that maps the host name to it’s current server.
# new server 22.214.171.124 mywebsite.com www.mywebsite.com
The above entry will map my domain name to my current server’s IP so that I’m able to view the website. So, if I now visit the website with the URL, it will automatically show me the proper server so that I can continue my development or browsing.
You may need to clear your browser’s cache and restart it in order to see the effect.
After DNS propagation is finished, delete the new line from your hosts file.
The original article here.