The Hosts file on your computer is responsible for mapping hostnames to IP addresses. There are various reasons why you may want to edit your hosts file that I won’t get into here, but here in the office our main reason is to bypass the Internet on our development server located in-house. This means that if the Internet is down, we can still access our development sites via our web browser and continue developing.
We also will have clients edit their hosts file so they can see new versions of their site before we make any DNS changes.
The hosts file in Windows is located at:
Once you locate the hosts file, right-click on the file and open it in any text editor such as notepad. From here editing it is easy. At the bottom of the file we enter the IP address of our internet connection, followed by the domain we want to to bypass (make sure there is a space or tab between the IP address and the hostname). Repeat for any additional hostnames and we’re done. If you want to temporarily omit an entry without completely deleting it, just ad a # in front of the IP address. The system will simply ignore the entry. Now just save and exit your file and your done. An example entry:
On a Windows 7 machine you may not be able to edit the hosts file directly, in which case just simply copy the file temporarily to a different location, edit it there, then copy/overwrite it back to the proper directory.