The Perfect Host
The Hosts file is simply a plain text file for mapping network locations and is checked by Windows to see if there’s an entry whenever the user requests access to a website or network resource. Here’s how to block websites using it.
Step 1 – First you need to open the Hosts file with administrative access. To do this, click on the Windows Start button and type notepad. When Notepad appears in the search list, right-click it and choose Run as Administrator from the menu and click Yes for the UAC message authentication.
Step 2 – Within Notepad click File > Open and navigate to c:\Windows\System32\drivers\etc. Click the drop-down menu saying Text Documents and change it to All Files. This will list the files within the etc folder. Click on the Hosts file, then click the Open button.
Step 3 – You can see that the Hosts file is a historic text file dating back from the early days of networking and communications. The localhost entry at the bottom of the file, 127.0.0.1 is your computer. This is the important entry, as we’re going to fool the networking services into believing that a website is stored locally.
Step 4 – It’s this fooling Windows that makes this such an effective solution to blocking sites, as you’re not fiddling with your router or other networking devices. Let’s say, for example, you want to block BDM Publications. Open a browser and go to the BDM Publications website, https://bdmpublications.com.
Step 5 – Either close or minimise the browser window and get back to the Hosts file in Notepad. Press Enter a couple of times to start a new line under the last hash and type in: 127.0.0.1 bdmpublications.com. Don’t add the HTTPS or the www part, just as it appears in the address bar.
Step 6 – In Notepad, click File > Save, to obviously save the newly edited Hosts file. Now get back to your browser and either refresh the page or close and reload the browser. When back up, in the address bar enter the site: https://bdmpublications.com. You can now see that the page won’t load.
Step 7 – You can try searching for it via Google or Bing but it still won’t load as you’ve successfully blocked access to the website’s hostname from the Hosts file. You can also see that any sub-domains after the main bdmpublications.com address are also blocked, which is certainly handy for some sites.
Step 8 – What we’ve done here is fool Windows’ networking services into thinking that the website bdmpublications.com, is being hosted on the computer itself and not out there on the Internet. If we wanted to remove the block, we can simply delete the line or put a hash at the start of the line and save the file.
Step 9 – Over time you can add more sites to the Hosts file list, pointing each one back to the 127.0.0.1 address of the local computer to block it from ever being reached; even if you use a different browser or other internet accessible program.
Step 10 – If you want a complete list that’s already been created, then WinHelp2002 provides a downloadable compressed Hosts file that you can replace your own with. You can find it here; just read the instructions to replace the new Hosts file.