The Hosts File is a system file that is part of the standard process that Windows uses to work out what IP address a FQDN (Fully Qualified Domain Name) points to.
Before performing a DNS lookup (See this article for more information about how DNS works), Windows will check to see if there have been any entries added to the Hosts File. This allows us to do things like viewing a new version of a website before it has ‘Gone Live’ for the rest of the world.
To edit your Hosts file, you will need to run Notepad (Or any Text editor if you prefer). The Hosts file is a ‘System File’, which means that you need to run the application as an administrator to make changes.
Open Notepad. Open the Start menu (Hit the “Windows Key”), start typing Notepad, right-click on the icon and select ‘Run as Administrator’
Open the Hosts File. In Notepad, select Open, under the File Menu at the top-left of the window. Go to the following folder:
c:\windows\system32\drivers\etc\
In the drop down menu on above the ‘Open/Select’ button choose “All Files”. Select ‘hosts’ and click ‘Open’
Add the new Entry. On a new line at the end of the page enter the IP Address that you want to load a website from, then the domain name(s) of the website. If you have multiple URLs (For instance, example.site and www.example.site), add them on the same line, separated by a space.
Save the file. Under the File Menu, select ‘Save’. Be Careful, Notepad might try to save the file as ‘hosts.txt’ instead of just ‘hosts’. When saving the file, make sure you select ‘All Files’ from the ‘Save as type’ drop down below the file name.