Block ANY Website in ALL Browsers using Windows Hosts File!


Step by Step Procedure as depicted in the above Tutorial Video:
Suppose you want to block facebook.com on your Windows 7 PC, so that NO User, whether he/she is having an Administrator Account, Limited (Standard User) Account OR Guest Account, can access facebook.com in ANY Browser in ANY way (unless he/she knows about Windows Hosts File and how to undo the changes you’ve made).
1. Windows 7 Hosts File is located at: C:\Windows\System32\drivers\etc (Assuming C Drive is your Operating System Drive). Copy this location:
windows 7 hosts file
* For other Windows Operating System viz. Windows 95/98/ME, Windows NT/2000, Windows XP (Both Home & Professional Editions) and Windows Vista (Home Basic / Home Premium / Business / Ultimate), the Hosts File Location will remain same i.e. C:\Windows\System32\drivers\etc
2. Click on Start Button >> All Programs >> Accessories and look for Notepad.
3. Now Right Click on Notepad and Select Run as Administrator:
notepad run as administrator
4. Click Open… (CTRL + O) in Notepad and Paste the Hosts File Address in it >> Press Enter and Select All Files from the Drop Down Menu >> Click Open Button:
hosts file windows 7
As soon as you click on Open Button, the Hosts File will open in Notepad. Now, as shown in the Video above, enter following lines at the bottom of the Hosts File:
127.0.0.1<HIT TAB KEY>facebook.com<SPACE>www.facebook.com
For blocking Multiple Websites, enter following lines at the bottom of Windows Hosts File:
127.0.0.1<HIT TAB KEY>facebook.com<SPACE>www.facebook.com
127.0.0.1<HIT TAB KEY>alexa.com<SPACE>www.alexa.com
127.0.0.1<HIT TAB KEY>yahoo.com<SPACE>www.yahoo.com
… And So On …
* Here facebook.com, alexa.com and yahoo.com are taken as an Example.
5. Now, click on File Menu and Hit Save Option to make changes in the Hosts File of Windows 7.
The URL/Website Address(es) you enter after 127.0.0.1 (Loopback IP Address ) in Windows Hosts File, will NOT open in any Browser, unless you undo the changes.
Note:
  • Notepad in Administrator Mode in Windows 7 can ONLY Save the changes you made in Windows Hosts File. You may not be able to Save Windows Hosts File, if you run Notepad in default mode
  • In Windows Vista, if you get a UAC Prompt click Continue or if you get an Error while modifying Windows Hosts File read THIS  Article from Microsoft
  • Since there’s No Administrator Mode in Windows 95/98/ME, Windows NT/2000 and Windows XP (Both Home & Professional Editions) Operating Systems, you can edit the Hosts File normally using Notepad
  • There are many softwares available on the Internet (including Firewall) which can easily block access to unwanted websites, although Advance Users can easily end the Process/Process Tree of these Softwares by means of Windows Task Manager or other software available on the internet. Blocking Websites using Windows Hosts File is a lesser known trick
  • Allot Limited (Standard User) and Guest Accounts to other users who uses your PC, this will prevent them from editing Windows Hosts File (atleast in Windows 7), as it requires Administrator Password
  • Some Security Softwares may not allow you to change/alter Windows Hosts File. So either Follow their prompts or temporarily disable them.