Thursday, July 22, 2010

Block and redirect websites using HOSTS file

I am sure after reading my previous post you all might be wondering about 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!!! Excited then read on!

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,myspace and orkut you need to type
127.0.0.1    www.facebook.com
127.0.0.1    www.myspace.com

127.0.0.1    www.orkut.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. For this you need to type ping www.google.com in command prompt. That will give you the IP address which is 209.85.231.104
Now in you hosts file you need to type

209.85.231.104     www.yahoo.com


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

This can be used for hacking also. Think how???  :) :)