Search

Please Subscribe

Like it? Share it!

Add to: JBookmarks Add to: Facebook Add to: Mr. Wong Add to: Buzka Add to: Windows Live Add to: Icio Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: Jumptags Add to: Upchuckr Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Diigo Add to: Technorati Add to: Newsvine Add to: Folkd Add to: Google

Get Your Gear at Amazon

Sponsors

HostMonster.com
HostMonster! Reliable and Affordable Web Hosting!
BlueHost.com
BlueHost, A Great Web Hosting solution.
Amazon.com - Hot Deals
Amazon.com! Check out computer related hot deals!
Get Clicky - Web Analytics
Cool Web Analytics Tool! Give it a try and let me know what you think
Upgrade Memory
Upgrade Your Ram! Simple tools to help find the correct memory stick at a great price.
Home Windows Hacks How To Block A Specific Website with the Host File
How To Block A Specific Website with the Host File E-mail
The internet is a great place to find a lot of great and free information. There is also a lot of not so good content or not appropriate content out there. Let say your kids or spouse keeps going out to a website that you don’t wan them to be viewing. In this article we will walk through the steps on how to redirect the traffic from the bad site to what ever site you want.

 

(Note: In this example I am using a windows XP machine. There are a few more steps involved in changing this in Vista. I will cover this in a later article.)

 

In this example I am going to redirect Yahoo.com to Google.com

 

We are going to want to get the IP address of the site we are going to redirect the bad site to. So in this example I am going to redirect yahoo.com to google.com. I will need to find the IP address of google.com.

 

Go to your Start menu and select run

 

Start

 

 

Type cmd and hit ok

 

cmd

 

 

You should now see a black DOS window.

 

DOS

 

Type the command ping google.com and hit enter

 

Ping Websitenamehere.com

 

 

You can swap out google.com with what ever site you want.

You should now see what the IP address is. It should be 4 sets of numbers separated by “.”. So in this example it is 209.85.171.99. Right down this number.

 

IP Address

 

 

Next thing we will need to do is locate a file named host. This file can be found in C:\WINDOWS\system32\drivers\etc

 

Path to Host File

 

 

You will need to open this file with notepad.

Right click on it and select Open

 

right click select open

 

 

You will need to select notepad from the list of applications and hit ok

 

Select Notepad

 

 

You should now see a file that looks like this.

 

Default Host File

 

 

We are now going to add an entry. You will want to add it just below the 127.0.0.1 entry.

The first part will be the IP address of the website you are going to redirect to. So in this example it would be my Google’s IP address (209.85.171.99)

 

Enter the new sites IP Address

 

 

The second part is the site name. This would be the bad site that you don’t want however visiting. In my example it is yahoo.com

 

OLD Sites Name

 

 

Now that you have entered the redirect we will need to save the file and test it. If you have visited the bad site and have not closed your browser since then, you will need to close your browser and then open it for the changes to take effect.

 

You can see here that I entered Yahoo.com and it sent me to google.com.

 

Redirect in action

 

 

So how does this work. Most websites have a domain name associated with the IP of the server. When you type in the domain name (example: yahoo.com) it first goes and looks at your host file to see if the entry is in there. If it is not then it goes out to your internet provider to find the IP address of the domain name. Since we put an entry in here for that site it uses the IP address that you supplied.

 

Please give us some feedback, let us know your thoughts about "How To Block A Specific Website with the Host File"!

Bookmark with:

Deli.cio.us    Digg    reddit    Facebook    StumbleUpon    Newsvine
 


Another articles:


mixedperic.com
Feedback Form