A hosts file is an address book, situated on your local desktop, that maps a host name to an IP address (network name resolution). Generally, a domain name (host name) is translated in to IP address via the DNS resolution process. However, the host entries that are present in this file will bypass this DNS resolution.
This can be of great help when:
You have modified the Name Servers, and are viewing the cached results due to the DNS propagation delay.
You are in process of migrating the hosting server, and want view the website on the new server when its still under development. This way you can preview the site in the developmental stage, whereas your visitors will continue to view the live website on the old server. Thus, the traffic to your site remains unaffected.
To view the results with such immediate effect, you can define a host/domain name in the hosts file.
1. Go to C:WindowsSystem32driversetc and locate the hosts file.
2. Open it in any text editor like Notepad, Notepad++, etc.
3. Add your host entires as shown in the snapshot below and save the file.