Blocking Websites

Only available on StudyMode
  • Download(s) : 115
  • Published : December 25, 2012
Open Document
Text Preview
How to block a Website
Ever felt the need to block certain websites. The Hosts file is like an address book. When you type an address like www.yahoo.com into your browser, the Hosts file is consulted to see if you have the IP address, or "telephone number," for that site. If you do, then your computer will "call it" and the site will open. If not, your computer will ask your ISP's (internet service provider) computer for the phone number before it can "call" that site. Most of the time, you do not have addresses in your "address book," because you have not put any there. Therefore, most of the time your computer asks for the IP address from your ISP to find sites. If you put server names into your Hosts file with your own computer's IP address, your computer will never be able to contact the server. It will try to, but it will be simply calling itself and get a "busy signal" of sorts. Your computer will then give up calling the server and nothing will be loaded, nor will any tracking take place. Your choices for blocking sites are not just limited to blocking servers. You may block sites that serve advertisements, sites that serve objectionable content, or any other site that you choose to block. Computers have a host address of their own - it is known as the "localhost" address, with an IP address of 127.0.0.1 which it uses to refer to itself. If you associate another computer's host name with your localhost IP address, you have effectively blocked that host since all attempts to access it will lead back to you. That is how we will block sites using the Hosts file. We will tell our computer that the IP address of the site we want to block is our own address. That way, our computer will not ever leave and go looking for the site we are blocking - which keeps that site from appearing because the computer thinks it has found the site and displayed it already. There are some limitations though such as,

1. It will not work with wildcards, such as *.example.com.
2. It will not work with URL's that begin with IP numbers.
Here's a simple common trick that can be implemented without being a geek. First make a bacup of the host file or rename it to host.old. You need to edit the "host" file, just open the file "host" with notepad located in "C:/Windows/System32/ drivers/etc"

The default host file looks something like this:

# Copyright (c) 1993-2006 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 # space.

#
# Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. #
# For example:
#
# 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
::1 localhost
127.0.0.1 www.example.com

Now just add add a line after the last line eg: "127.0.0.1 www.example.com" without quotes, this will block access to the website "www.example.com", provided you don't host a website locally with the same domain name, you should replace "www.example.com" with the offending website you want to block access. Save it, restart your favourite browser and done. You can block any number of sites, just prefix it with "127.0.0.1". To regain access to it just delete that line, here removing the line "127.0.0.1 www.example.com" will unblock it and let any browser to access www.example.com.

If you have a proxy server:
You should only need to do this step if you use a proxy server. Examples of proxy servers include: WebWasher, CookieCop Plus, and a web cache server provided by your ISP. If you don't use a proxy server you can...
tracking img