LOGO

Create an Internet Filter Using the Windows Hosts File

January 6, 2008
Create an Internet Filter Using the Windows Hosts File

The Dual Nature of the Internet and a Simple Filtering Solution

The internet offers numerous advantages, yet it also presents drawbacks that many users find frustrating. While pop-up advertisements are a common annoyance, parents often seek ways to shield their children from inappropriate content online, including websites deemed unsuitable for young viewers.

It's worth knowing that establishing a personal internet filter to block specific websites and pop-up windows is achievable, and the necessary tool is already integrated into the Windows operating system – the Hosts file. A single line added to this file can effectively prevent access to unwanted online destinations.

Locating and Accessing the Hosts File

The Hosts file is situated at Windowssystem32driversetchosts. Notably, it lacks a standard file extension. Consequently, when you attempt to open it, you will be prompted to select an application. Choose Notepad to open it as a plain text file. For those unfamiliar with the Hosts file, creating a backup copy before making any modifications is highly recommended.

Upon opening, the file will display content similar to this:

create-your-own-internet-filter-with-the-windows-hosts-file-1.jpg

Pay attention to the line 127.0.0.1 local host, which represents your own computer.

Blocking Websites with the Hosts File

Preventing a website from being accessed through your browser is a straightforward process. For example, if you wish to block Google, you can effectively banish it from your browsing experience using the Hosts file.

At the end of the file (below 127.0.0.1 local host), add the following line:

127.0.0.1 www.google.com

Save the file and close it. However, ensure the following points are addressed for proper functionality:

  • Verify that the file retains the name "hosts" without any file extension (such as "hosts.txt"). Remove any extension Windows may have added.
  • Do not include "http" at the beginning of the URL. Only "www" is sufficient.
  • Restart your browser to apply the changes. In some instances, a brief delay may be required for the URL to be blocked.

Attempting to access the blocked site will now result in a blank page, rendering it inaccessible. Every attempt to reach the URL will be redirected back with this empty page.

create-your-own-internet-filter-with-the-windows-hosts-file-2.jpg

Should you later decide to regain access, simply open the Hosts file, delete the added line, save the changes, and restart your browser. Google will once again become available.

Applying the Technique to Pop-up Advertisements

This method can also be used to block intrusive pop-up ads. When an ad appears, note the URL it originates from and add it to your Hosts file. Saving and closing the file, then revisiting the website, should eliminate the unwanted pop-up.

While modern browsers typically include built-in pop-up blockers, these are not always foolproof. Some websites can circumvent these blockers. Therefore, utilizing the Hosts file can provide an additional layer of protection.

Utilizing Pre-compiled URL Lists

Online resources offer lists of malicious URLs that can be added to your Hosts file, encompassing pop-up ads, spyware, trojans, and potentially objectionable content. However, a cautious approach is advised. These lists may sometimes include URLs that block legitimate websites. Therefore, manually adding entries on a site-by-site basis is often preferable.

Ultimately, the Hosts file provides a relatively simple method for filtering unwanted content, whether it's persistent advertisements or inappropriate websites for children.

#windows hosts file#internet filter#website blocking#block websites#hosts file tutorial#parental controls