How to Check and Fix your hosts file on Windows XP
You try to visit a website and your internet browser keeps on redirecting to different sites, with popups, and content that aren't even close to the address you typed in. Let's look at the Windows XP Host file and how to fix it.
What is a hosts file
Without going into any great detail you only need to understand the following: Every computer connected to the internet is not assigned a name, it is assigned a number called an IP address. When you type in an address into your browser such as www.yahoo.com what your basically doing is trying to connect to a computer server. But remember, all computers are assigned a number, so yahoo.com actually needs to be resolved to a computer number. No need to get technical but there are services that are "invisible" to you that will take the name, perform a lookup and return the proper computer number so you can make the connection. It just so happens that one of the first places to do a Name to Number lookup is the hosts file on your computer.
What does this mean? If a malicious person wants to hijack your browser and redirect certain addresses to another site they could use the hosts file to do this. All they would need to do is add an entry to the hosts file to redirect any number of sites. So if your browser isn't going where it should be, a good place to look first is the hosts file.
Find the Hosts File
Open up Windows Explorer or My Computer (Whichever you prefer). You need to access the Windows folder on your root drive which is usually on 'the 'C drive' and the folder is usually named 'Windows'. Once in the Windows folder you'll need to open the 'System32' folder, then the 'drivers' folder, followed by the 'etc' folder. The complete path to where the hosts file is located is usually something like C:\WINDOWS\system32\drivers\etc. Once you've located the hosts file open it using Notepad. One thing to note: be aware that your windows installation might be in a different folder then the one mentioned above. 'Windows' is usually the default but it could also be 'Winnt' or something similar.
Open the Hosts File
If you double click the file and it asks which program to open this file with, select Notepad and make sure you leave the 'Always use the selected program to open this kind of file' box unchecked.
Check, Fix and Clean the Windows Hosts file
Once you've opened the file you should see a description with some examples at the top of the file and then depending on whether your hosts file has had entries added to it some numbers will be on the bottom. Note that any line starting with the # symbol is a comment and therefore will not have any effect (in other words it is harmless). For most users the only uncommented line (i.e. a line that doesn't start with #) should be 127.0.0.1 localhost. This just refers to your own computer; 127.0.0.1 is the internal IP used for your computer.
Any other line that doesn't start with a # can be deleted or if you're afraid to completely delete a line then just comment out the line using the # symbol which will disable the entry. Then if everything is working properly you can come back later and clean out unneeded lines.
That's all there is to it. It's pretty simple to fix but a hosts file can cause a lot of problems if it is modified by a malicious program. If you're still having problems, or if you're hosts fixes keep coming back then you probably have a larger problem in which case you may want to check out another Tech Help article on Spyware Removal.