Windows 7/XP/Vista: How to Block Unwanted Sites Without Additional Software

Contributor Icon Contributed by Rob Rogers  
Tag Icon Tagged: Windows  

If you want to keep your youngsters from accessing certain sites, you want to block certain cites due to their content, or if you want to play a mean joke on a co-worker, you can block sites by redirecting them to the computer’s IP address that is used for a loopback network connection.

1. Open Computer (My Computer on Windows XP machines).

2. Browse to C:\Windows\System32\drivers\etc

3. Right-click the hosts file and open it with either Notepad or Wordpad.

4. Scroll to the bottom of the page.

5. Input the following:127.0.0.1       Siteyouwantblocked.com

where siteyouwantblocked.com is the name of the site you wish to block. Press Enter and repeat this step until you have entered all desired sites.

6. Add an extra carriage return by pressing Enter.

7. Save the file.

8. Close Notepad (or Wordpad).

The sites that you have added to the hosts file will now be blocked.

 

18 Comments -


  1. alyssa said on October 5, 2009

    def gonna try this, thanks.

  2. Anonymous said on October 6, 2009

    I tried this mentod in my PC,but it was a failure.

  3. Anonymous said on October 8, 2009

    If you tried it and it didnt work, then you made a mistake along the way.
    I have used this successfully for years; both as a protection scheme and as a general havoc causing issue.

  4. citruscyanide said on October 15, 2009

    Same. Does it not work through a proxy? Or what am i doing wrong?

  5. Anonymous said on October 19, 2009

    It’s a well used method.If it doesn’t work for u,you’re def doing something wrong.Don’t forget the 127.0.0.1 at the beginning,and one of the common probs,make sure it’s saving when u exit.If it doesn’t,right click the hosts file,properties,and make sure read only isn’t checked,otherwise it won’t save.Put it back after u’ve saved it,and it prevents any bad software / sites changing the file.Some antivirus and other security progs lock this file

  6. Bilal said on October 24, 2009

    wao that was grate i found what i was looking for thx for help.

  7. Anonymous said on May 21, 2010

    it does not work in windows 7

  8. Anon said on September 17, 2010

    Confirmed this does work on Win7 today. Thanks!
    (additional: A reboot was required for it to start working)

  9. Annoyed Amos said on October 1, 2010

    Same, It Dosen’t Works..

  10. Ergzay said on October 23, 2010

    Confirmed doesnt work

  11. Benjch said on February 3, 2011

    Not working in Windows 7 :-(

  12. Affanbinsayeed said on March 14, 2011

    I tried to block particular website but its unable to save the file …It asking me where to save ,i checked in properties everything is ok… please help me…

  13. mr tact said on March 31, 2011

    ,,,ancient and no longer applies to W7

  14. Crystalguy536 said on March 31, 2011

    it is asking permission 2 get saved .how can i give permission.??????

  15. Latino said on April 15, 2011

    For those of you who aren’t getting this to work on Windows 7, here are the required steps:

    1) Open notepad with administrator rights
    Open Start Menu, type “notepad” in the search box, right click the notepad icon and select “Run as administrator”

    2) In Notepad, open the hosts file
    Choose option File > Open from the menu, go to C:WindowsSystem32driversetc and choose the “hosts” file
    Note: the “etc” directory will probably be hidden, but you can just press F4 and type the path above

    3) Insert your sites
    Go to the end of the file and enter a new line with the following format
    127.0.0.1 site1 site2 site3
    replacing “site1″, “site2″ and “site3″ with the url’s of the sites you want to block.

    Example:
    127.0.0.1 facebook.com hi5.com myspace.com

    You can put as many sites as you want on that line. Just remember to separate them with a space and never press enter (to keep them all on that line).

    4) Save the file and close Notepad

    5) Open a command line client
    Open Start Menu, type “cmd” on the search box and press enter

    6) Flush the DNS cache
    In the CMD window type “ipconfig /flushdns” and press enter.

    This command will clear the dns cache and reload the hosts file.
    With this you don’t need to restart your computer after changing the hosts file.

    I also advise you to close and re-open your browser.

    Hope this helps =)

    Best regards,
    Latino

  16. shivam chauhan said on May 1, 2011

    i tried this method but i can’t save the file at the etc folder with the host.txt
    there is an error

  17. Raju said on June 23, 2011

    Hi
    This solution is not for windows 7 its work onlu windows XP

  18. Braca85 said on January 20, 2012

    not working on windows 7…. :-( How can I fix this?

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -