Web Development Blog

by Ei Sabai Nyo

02 Jan, 2008

The easiest method to blocking websites    

There are many ways to block a website – there are thousands of website filter software available these days, but the easiest way to block an unwanted website without installing any software is by editing hosts file. Yes, that’s right. I only found that out after reading Block Unwanted Websites – by just editing host file blog post on Techie Portal website. I knew about hosts file and I knew how it worked before I discovered the post but it has never come across my mind to use it as a way to block unwanted websites on your computer. Ah the little things that you overlook.

Open HOSTS file which is located at C:/windows/system32/drivers/etc using notepad.

[Screenshot of HOSTS file]

Lets say you want to block www.hityou.com

Just add 127.0.0.1 www.hityou.com as shown in the image above. You may also add the site without the www. for added safety.

Thats it !!! Now when you try to open the website, your browser will be unalbe to connect to this website because the DNS for the website has been changed to 127.0.0.1 instead of the real DNS.

To find out more about how to block unwanted sites by editing hosts file, check out the original post.

Technorati Tags: , , ,

Love what you've just read? Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
Your name:   Your email:  

7 Responses to “The easiest method to blocking websites”

  1. Melissa says:

    I tried your method but when I click save it says that it can’t and to make sure the path is correct. I can’t figure out how to get it to save my chances without that message coming up. Any thoughts on what’s wrong?

  2. Chuck says:

    Hey, i tryed doing this but only some websites get blocked not all of them! :(

  3. wojtekm says:

    1) u have tyo have admin access to save this file
    2)
    u have something wrong with your syntax
    make sure u added both http://www.website.com and website.com ie:

    127.0.0.1 http://www.100888290cs.com
    127.0.0.1 100888290cs.com

  4. elai says:

    I’ve tried but it didn’t block any website, does it work on googlechrome and Firefox?
    I did just the way it’s explained here……….

    can you solve the prob please?

  5. eisabai says:

    Hi elai. This solution is not browser-dependant. However, as wojtekm said, you need to have administrator right on the computer to save the file. And please make sure the syntax is correct and you have entries for both with www and without.

  6. I see others have commented about having admin rights. One step I still see missing is after editing the hosts file you must close and reopen all your browser windows for the changes to take affect. I also make a point and click instructional video on how to complete the steps in this blog. The video can be found here.

    http://helpviavideo.com/watch.php?vidid=37

Profile PicHello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more about me or have a look at some of the tips & resources I've written.
Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
We do NOT spam.
Your name:  
Your email:  

Tips & Resources

Tips & Resources
WordPress Web Hosting
Recommended web hosting providers for WordPress 3.0
iPhone Native App Development
Important steps into iPhone app development for beginners
iPhone Web App Development
Tips for iPhone web app development
Coupons for Web Developers
Get discounts on web hosting, domain names, templates, etc
10 Useful jQuery Snippets
Easy-to-use jQuery snippets for any website
HTML Email Newsletter
Step-by-step tutorial on how to code an HTML email newsletter
  • bluehost Hosting $6.95/month
  • Joomla Templates

Recommended Book

Categories