Sometimes we may need users not to access a specific websites from a computer, in that we have to block that site from being accessed from that computer. To do this we can have different options like blocking from router, it can be blocked from browser itself or you can block site using third party software or firewall can also block sites, but today I will show you how to do this using windows hosts file.
In windows hosts
file is a small plain text file (with no
extension) that is used by the OS to map IP address to hostname before DNS,
this file can also be used to redirect a domain name back to
the local computer, which will block the desired website.
This file is
located at this directory C:\Windows\System32\drivers\etc
(in windows) and in
Linux it is located at /etc directory
Requirement for to do this
action is, you need to have windows
administrator account (usually the built-in one)
To limit/block the desired
website from being accessed using hosts file we need to map the website we
want to block to a local IP address called localhost/loop-back.
i.e., 127.0.0.1, to do so you need to follow the below steps:
1. Open the hosts file by
going to the directory stated above
2. Once opened, go to the last line and type 127.0.0.1, type space to give one space between the IP
and the hostname, then type the name of the site you want to block as follows,
it should be on the same line:
127.0.0.1 www.google.com
127.0.0.1 www.facebook.com
3. Once you added the entry you want, don’t
forget to save, you have to save in same directory stated above and the
same name hosts, don’t add any extension, when you save select all files from the save
as type drop down menu , if
possible use Some other Text editor
other than notepad such as notepad ++.
Note: If you are using built in administrator account, it will save without
a problem, but if you are using non-built in administrator, save it using this
method.
4. Finally check if the result is applied, you may need to restart the browser
If you want to watch the video,click here
Thanks for your visit!