Using the hosts file to block websites

Many are looking for ways to block websites such as websites with pornographic material and the like. Here is a possible way to do the blocking

Level 1: Finding the relevant system file, the location of the file is different in the different operating systems.

Windows 95/98/Me – %windir%\
Windows 2000/XP/2003 – %SystemRoot%\system32\drivers\etc\
Windows NT – C:\winnt\system32\drivers\etc\

Notepad level2: Editing the file. Open the file with

After opening it, you will find the following lines in the file:

  • # Copyright (c) 1998 Microsoft Corp.
  • # This is a sample HOSTS file used by Microsoft TCP/IP stack for Windows98
  • # This file contains the mappings of IP addresses to host names. Each
  • # entry should be kept on an individual line. The IP address should
  • # be placed in the first column followed by the corresponding host name.
  • # The IP address and the host name should be separated by at least one
  • # space.
  • # Additionally, comments (such as these) may be inserted on individual
  • # lines or following the machine name denoted by a '#' symbol.
  • # For example:
  • # 102.54.94.97 rhino.acme.com # source server
  • # 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost

Now, to add sites to the blocked list, we will add a line like the following line, with the name and address of the relevant site instead of the addresses in the example

The address 127.0.0.1 is actually a reference back to the searching computer itself. When we try to open the website that appears in the line we added, the browser will try to search for the website on our computer. Since the site is not on our computer but somewhere on the Internet, access to the site will not be possible

You may be interested in: