The internet has lots of benefits but on the other hand, it has its downsides that we all love to hate. The most common one is pop-up ads but if you have young kids who like to surf the net, then as a parent, you will want to protect them from porn sites and any other sites you deem undesirable for such young impressionable minds - such as the Teletubbies.

Well you may not know that it is relatively easy to set up your own internet filter to stop certain websites and pop-up windows from being accessed and shown on your computer - and it already resides on your Windows operating system in the form of the Hosts file. Just adding a line to the file can stop a website or a pop-up window in its tracks.

The Hosts file is located at Windowssystem32driversetchosts. The file has no file format so when you double-click on it, you'll be asked how you want to open it. Just choose Notepad to open the file as a text file. If you are not so experienced in dealing with the Hosts file, you may want to make a backup of this file before you start altering anything.

When it is opened, this is what you will see :

windows-hosts-file.gif

The first thing you have to notice is the line 127.0.0.1 local host at the bottom. That's your computer.

To block a website from your browser is very easy. Say you suddenly develop an overwhelming hatred for Google and you want to banish them to the internet graveyard. Time to give it the Hosts file treatment!

On the bottom line of the file (underneath 127.0.0.1 local host), just type :

127.0.0.1 www.google.com

Save it and close the file. But there are three things to make sure of to ensure this works properly :

  • Make sure that the file is still called "hosts" (without a file format at the end such as "hosts.txt"). If Windows attempts to assign a file format to the file, remove it.
  • Do NOT add "http" at the start of the URL. Doing so makes the entry invalid. Just "www" is enough.
  • You will probably have to re-start your browser for the changes to start working and in some cases, it may take a minute or two for the URL to be blocked.

Now try to access the site in question. You'll see that you now get a blank page. Totally inaccessible. Every attempt to access the URL just gets automatically bounced back to you with the blank page.

windows-hosts-file.gif

If you suddenly decide you're madly in love with Google again, just open up the Hosts document again and delete the line you just inputted. Save and close the file, then re-start the browser. Google will suddenly become available again.

So how does this stop block-up ads? Well when the ad comes up on your screen, take a note of the URL that it is coming from and add it to your Hosts file. Save and close then go back to the website in question. You'll suddenly find that pop-up ad doesn't appear anymore!

Now you're probably saying that with pop-up blockers being standard in browsers these days, what's the point of this? But pop-up blockers are not 100% perfect. I know of one website that overpowers the pop-up blocker and loads up pop-up windows without any resistance from Firefox or the Google toolbar pop-up blocker. So sometimes you need a little more than your browser to stop those nasty critters.

If you do a Google search, you'll find people who have compiled lists of malicious URL's that you can add to your Hosts list. This includes pop-up ads, spyware, trojan horses and porn. But I prefer to just add to the Hosts file myself on a site-by-site basis. Creators of these URL lists can get a bit carried away with privacy and end up giving us URL's that can block sites we may consider legitimate. So I think it's best to do it yourself.

So if you have essential sites constantly popping ads up at you or if you want to filter out naughty sites from your kids, the Hosts file is a fairly simple way of doing it.