How to Block Websites Using a Hosts File

Windows operating systems use a "hosts" file as an internal way to control what URLs resolve to what IP addresses. Before a program looks up the IP address for a URL using a DNS server, it is routed through the hosts file. By redirecting websites that you want to block to the IP address of your own computer, you can block access to them from any program on your computer.

Instructions

    • 1

      Click on the "Start" menu and open a text editor, such as Notepad. If you are using Windows Vista/7, right-click on the program and select "Run as Administrator."

    • 2

      Click on the "File" button, click "Open" and open the file called "hosts" in the "C:\windows\system32\drivers\etc" folder on your computer.

    • 3

      Edit the file by adding two lines for each website you wish to block. The first line is "127.0.0.1 exampleurl.com" and the second is "127.0.0.1 www.exampleurl.com." In both cases, replace the example URL with the one you wish to block.

    • 4

      Save the file and the website blocking is complete.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured