Click here to Skip to main content
13,256,304 members (50,165 online)
Click here to Skip to main content
Add your own
alternative version


6 bookmarked
Posted 11 Sep 2012

Blocking Particular Website in Computer

, 11 Sep 2012
Rate this:
Please Sign up or sign in to vote.
How can I block some website permanently like ( and more social site on my employees computers


Many times while answering on community forums and surfing on the Internet, I have a question about how to block a particular website on the computer. This is from sensible parents who care for their child, administrators who manage Office and Office Network at work. This is really a great problem in case of social networking sites. I have searched and tried almost all softwares, Windows Features like parental security, content adviser, etc. But some of them throw annoying messages or some pop-ups and graphical disturbance.

So finally, I tried hosts file which is a threat according to Microsoft Security Essential. But it does not harm your system in any manner and does not install any third party software on the computer.


I have tried to block access to those sites from Router Configuration, but at some point I need to enable them in particular PCs which is really difficult and a hard task. So I am here to tell you the method of blocking websites using hosts file.

How to Change Setting

I am going to tell you about changing the setting. To do so:

  • Open Notepad with Administrator Rights.
  • Ctrl+O to Open File. Choose File Path Below.
  • Windir:(C: )\Windows\System32\drivers\etc
  • Change File Type to All Files from Right Bottom Corner.
  • Choose hosts file and open it.
  • You will see the below lines at the end of the page:
    #       localhost
    #::1             localhost

    Now just add this code to block a website named and an IP address.

    Using IPv4: (Sample IP - So Invalid)

    Using IPv6:

    ::1 (Sample IP - Used Invalid)

    Now save this file. If you are using antivirus, this may disinfect it, so disable Real Time Protection for some time and after saving changes, enable those settings of antivirus.

You are done, open any browser and enter the blocked URL in address bar and click navigate button. See the result.


This will block access to the mentioned website in your system in all applications. So you don't need to worry about Browsers, Chatting Applications, Desktop Programs, even a link to Website or IP address.
You have to change some setting in individual PCs for doing so.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

John Bhatt
Founder P.Yar.B Complex
Nepal Nepal
John Bhatt is an IT Professional having interest in Web technology. He is Web Designer, Developer, Software Developer, Blogger and Technology Geek. Currently he writes his Blogs at Blog of P.Yar.B and various other Sites. He is Main author and founder of Download Center.
Contact Him at : Facebook | Twitter | Website | PRB - Blog.

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171114.1 | Last Updated 11 Sep 2012
Article Copyright 2012 by John Bhatt
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid