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.