Some time ago I needed to block some websites in order to forbid the internet access of a software that automatically use internet to send/receive different information. I was also asked by some friends about a method to block different websites like porn, torrents or illegal websites.
In this article I will show you a method to block any website you want without using any special software and nothing but just a text editor (notepad). This method apply to:
– block individual illegal websites in order to not be accessible by any users
– block any desired website in order to forbid users access to it (like games, social websites or any website you want)
– forbid your installed software to access specific internet addresses (like downloading updates or send your private information)
The solution is simple and basically assume to edit a special windows file called “hosts”. You can read more about “hosts” file on wikipedia by this link. So … If you want to block a website follow this steps:
1. Go to Explorer to this location
C:\Windows\hosts for Windows 95/98/Me
C:\Winnt\system32\drivers\etc\hosts for Windows NT/2000/XP Pro
C:\Windows\System32\drivers\etc for Windows XP Home/Vista/7
2. Copy “hosts” file to your desktop
3. Double click on the “hosts” file from your desktop and choose Notepad from “Open with” list
4. You’ll found there some instruction about how to use that text. The idea is that using this text we can remap the IPs of specific hostnames (websites). The IP is the internet address where a website is located. In this way, if we change the address where a specific website is searching for information (for it’s content) we can also block it by specify a wrong or non-existing address.
When we want to block an website address is recomanded to use 127.0.0.1 as it’s new IP address. The 127.0.0.1 is the IP of your computer (DNS will return to your real IP if you go to that address), also called localhost. Because most of the time you don’t host a web-server, that IP address will not be capable to return any information so we’ll see something like, the website is down and not-responding.
In my example I will block facebook.com. For that I changed my “hosts” document in this way:
5. Select File menu and Save. Then put back “hosts” file from Desktop in the Windows folder (location from point 1) by overwrite the old “hosts” file.
6. Restart your computer.
After you restart your computer you will not be able to access the websites you specify in the “hosts” file. You can put as much websites you want, each on his own line starting with localhost IP and then the website address you want to block.
Hope this was helpful for you. Have a nice day!