Geeks With Blogs


Bill Evjen's Blog Code, Life and Community

You have a host file found at C:\Windows\system32\drivers\etc\hosts that allows you to specify IP addresses and their mappings to a URL. For instance, when you type in or something similar - you are actually going to an IP address ( that is mapped using a DNS server somewhere. Sometimes you are not going to want to do the DNS lookup, but instead use a specific and known IP address when a URL is typed in within your browser or if your application is using URLs to surf the Internet.

Opening the host file in Notepad, you can make these mappings yourself. By default you will find the following in the file:

# Copyright (c) 1993-1999 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:
#          # source server
#              # x client host       localhost

This shows only one entry - localhost. This means that when you type http://localhost/whatever you will actually be routed to (which is the IP address of your local machine without leaving the machine). One nice trick is that you can change this to something like the following:        m

Now instead of typing in http://localhost ... you can now use http://m. Also, getting the IP addresses of sites you frequently type in, you can do something like the following:   s        #   g        #

Here, typing in 's' will take you straight to (the pound or hash symbol signifies comments). Typing in 'g' will take you to Probably one of the coolest features you can accomplish with this host file is that you can route all requests to advertisements on a page to your local machine. This means that instead of your computer making a request to get the ad (usually a .gif or .jpg image) you computer will simply route the request to the local machine (thereby really never making the request). This will improve your browsing performance. So, for instance, take a look at the following:

So when a page is instructed to make a request to for the advertisement, you computer will instead make the request to the local machine - thereby not producing the ad on your computer. Obviously this would be a lot of work to compile a list of advertisement URLs - but you can find a complete list to put in your host file at This works on most Windows machines, including Vista. Enjoy a better surfing experience!

Posted on Saturday, February 16, 2008 7:50 AM | Back to top

Comments on this post: Better Surfing by Changing your Host file

# re: Better Surfing by Changing your Host file
Requesting Gravatar...
May be it's a bit off-topic.

There's a nice domain hack feature in Opera browser: you can enter /. into address bar and get to the site.

I use it quite often.
Left by Andrew on Feb 18, 2008 1:18 AM

# re: Better Surfing by Changing your Host file
Requesting Gravatar...
This is one of those "why did I not do this earlier" ideas. Thanks.
Left by J. Michael Palermo IV on Feb 19, 2008 7:09 AM

Your comment:
 (will show your gravatar)

Copyright © Bill Evjen | Powered by: