Ever wondered how a website in a local Internet Cafes is blocked? Ever been a victim of a prank where an irrelevant website is opened when you open Facebook? Stop wondering and read further to know how to block a website.
Why would you want to block a website?
1) You own a business and want to prevent your employees from wasting time. Of course there are different and more secure solutions for these.
2) Protecting your children from certain websites.
3) You have a limited internet connection and want to block certain websites to prevent over downloading.
4) Play a prank on someone.
5) Show people that you can now actually block websites.
How do you block a website?
1) Using hosts file.
2) Using your router
3) Using third party applications
Block a website using hosts file
It is located in C:/Windows/System32/Drivers/etc.
Let’s block a website using the hosts file.
Navigate to the path mentioned to locate the hosts file.
Just to be on the safer side let’s create a backup of the file. Just copy the file and paste it again. Give whatever name you want.
Now open Notepad as an administrator.
# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
# For example:
# 126.96.36.199 rhino.acme.com # source server
# 188.8.131.52 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
You will get something like this. The ‘#’ symbol represents comments. To block a website, just go to the end of the file and in a new line add something like this:
Here 127.0.0.1 represents the IP which you want to redirect your to-be-blocked-website. For this example, I am blocking “www.google.com” Sorry Google, no offence to you.
Save the file and you are done. I have installed apache on my localhost and hence I get a result like this when I try to open www.google.com
Similarly, you can also play a prank on your friends by simply replacing the “127.0.0.1” part by any website you want to be displayed when a particular website is opened.