Friday, March 1, 2013

Block and redirect websites using HOSTS file


how to block websites using HOSTS file, or even how to redirect them? It would be so cool to type http://www.google.com and see http://www.yahoo.com open infront of you.

Navigate to C:\Windows\system32\drivers\etc\hosts in your windowsXP,Vista or 7. (if C is the windows directory)

As you might have all known by now that hosts file does not have an extension and so you might be wondering as to how to open it.To open the HOSTS file drag it into a notepad or rightclick>open with>notepad.. It will look like the image I have put in.

BLOCKING WEBSITES
To block a website. Simply put
127.0.0.1     www.example.com    

Replace example with the website you desire. For e.g if you want to block facebook,twitter  you need to type
127.0.0.1    www.facebook.com
127.0.0.1    www.twitter.com



Now save the file. You are done. Whenever you type these websites in your browser it will display an error "The page cannot be displayed".

REDIRECTING WEBSITES

If you want to redirect google to yahoo,you need to know the IP address of google.com For this you need to type ping www.google.com in command prompt. That will give you the IP address
Now in you hosts file you need to type

x.x.x.x(ip address of google.com)     www.yahoo.com


So whenever you type www.google.com in your browser it will open www.yahoo.com.

0 comments:

Post a Comment

 
ExactSeek.com