Click here to Skip to main content
Click here to Skip to main content

Blocking Particular Website in Computer

By , 11 Sep 2012
 

Introduction 

Many times while answering on Community and surfing on Internet, I have a question, how to Block a particular website on Computer. This is from sensible Parents who care for their Child, Administrators who manages Office and Office Network on work. This is a 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 message or Some pop-ups and graphical disturbance.

So Finally I tried hosts file which is a Threat according to Microsoft Security Essential. But is does not harm your System in Any manner and does not install any third party softwares in Computer.

Background: 

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 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 that. 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 below Lines at Last of Page

#127.0.0.1       localhost
#::1             localhost
Now Just add this code to Block a Website named domainname.com and a IP address. Using IPv4
127.0.0.1 www.domainname.com

127.0.0.1 domainname.com
127.0.0.1 258.258.258.258 (Sample IP - So Invalid)

Using IPv6 

::1 www.domainname.com
::1 domainname.com
::1 258.258.258.258 (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 Setting of Antivirus.
You are Done, Open any Browser and Enter the Blocked URL in Address bar and click navigate button. See the Result.
Note
This will block access to Mentioned Website in your system in all Applications. So you don't need to be 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.

License

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

About the Author

John Bhatt
Software Developer (Senior) P.Yar.B Complex
Nepal Nepal
Member
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.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 11 Sep 2012
Article Copyright 2012 by John Bhatt
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid