Hosts File Trick (Windows XP) June 4, 2010Posted by Tournas Dimitrios in Uncategorized.
For those that don’t know, your Window’s “hosts” file can be used to map a domain name to an IP address to trick your browser into thinking routing requests for a particular domain to a different server.
This file is not typically needed in development, but if you ever need to map a domain to the IP address of a another server (i.e. a development server or QA server), then knowing how to edit this file may come in handy.
In Windows XP, this file is located here:
There are plenty of resources out there on how to edit this file, so I won’t elaborate on that, but I wanted to point out a trick that is handy if you are editing this file on a regular basis.
Since the hosts file doesn’t have a file extension, by default, you have to choose which program you would like to use to open it, when you double-click on it. You can fix this annoying behavior by following these steps:
- Create a shortcut to the hosts file on your desktop.
- Right Click on the shortcut and choose properties.
- Before continuing, you may wish to change the ugly icon by clicking the “Change Icon” button.
- Next, edit the field called “Target” to say this:
- Then click ok to save.
That’s it, now double-click the icon and it will open your hosts file in notepad.