I am retiring this website. Please visit my new blog here for all things tech-related: goo.gl/d7D1J

Thursday, October 20, 2011

Edit Windows Hosts File To Block Websites

One method to block websites in Windows is via the hosts file. There are other things it's used for but in this particular post we'll focus on that. We can redirect access from example.com to the local computer (or Google.com), thus returning something other than example.com when it's access is attempted.

Follow the screenshots below to access and edit the hosts file.


Access the hosts file
1)
Begin by navigating to your Windows directory.

Do one of the following to perform this step:
   A) Start > Run > Type %windir% (Windows Directory)



  OR

  B) Start > Computer > Open your root drive > Windows


    


2)
Then open System32 > drivers > etc


3)
Right-click the hosts file and edit it with a text editor


Edit the hosts file

The hosts file can point any website to any IP address.

1)
If you want to block example.com, choose an IP address to redirect access to when example.com is requested via the browser.

127.0.0.1 is the local hosts IP address. Choose this to block access and return no website when example.com is requested.
This can be performed on any number of websites.

2)
To have example.com access google.com, we need an IP for Google.

To do this, access the command prompt and ping Google.com

   A) Start > Run > type cmd

   B) Type ping google.com


3)
Use 74.125.73.105 as the IP in the hosts file and example.com to redirect example.com to Google.com. This can be altered for any website and any IP.


We've successfully redirected example.com to Google.com!

No comments:

Post a Comment

Web Analytics