Pages

Monday, December 3, 2012

How to block a website using windows hosts


You can redirect or block one or more web sites using the HOSTS file in Windows (and other operating systems). The HOSTS file is located in the folder %windir%\System32\drivers\etc in Windows XP, Vista and 7. It is basically a text file with two columns : the first column consists of a target IP address and the second column consists of the respective source site address. When you access a site listed in the second column, you are redirected to the respective site in the first column. The two columns should be separated atleast by a single space.

 Step 1
Open   my computer   ->  c drive  ->  windows -> System32 -> drivers ->  etc -> hosts
Open   Hosts  With  notepad  then edit it 


 Step2
This would open your hosts file in Windows' Notepad. Start editing at the end of the file : Press Enter to start a new line. Type 127.0.0.1. Press TAB key once. Then type the name of the site you want to block, in this case, gooogle.cn. You do not have to type the http:// or www. part of a web site. Then end result will look like this


Step3
Save the hosts file. Now when you type gooogle.cn in your browser, it will be redirected to 127.0.0.1 and is effectively blocked for all programs.