Hosts file in Windows is used to look for websites IP address whenever you type the website URL in your browser, Since IP addresses for websites won’t be in the Hosts file, your computer will ask your ISP to look for IP addresses of websites and open them. Unknowingly, if you made any modifications to the hosts file or some malware hijacked your hosts file, then you can reset hosts file to its default without affecting websites redirecting problems.
Hosts file location
Hosts file is hidden and will be located at “%WinDir%\system32\drivers\etc “. You need administrative privileges to access or modify the contents of the file.
To reset the hosts file to default
1. Navigate to hosts file by entering “%WinDir%\system32\drivers\etc “ in Run command box and press enter.
2. Now rename hosts file to hosts.bak or other extension old.
3. Now right click on empty space in that directory and select New>TEXT Document and type it’s name as hosts. Click ‘Yes’ to confirm changes and hosts file extension should not be text.
4. Now open this empty hosts file with notepad and paste the below text under title “Hosts file for Windows XP” in it and save changes.
Hosts file for Windows XP
# 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
# Additionally comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.#
# For example:
# 18.104.22.168 rhino.acme.com # source server
# 22.214.171.124 x.acme.com # x client host
If still the hosts file appears with text extension,
- Open Windows Explorer, from Tools menu, select Folder Options
- Remove tick mark for “Hide extensions for known file types” and now remove the txt extension after hosts file, and save the changes .
Update 26/02/11 : Download and run this Microsoft Fixit tool to automatically reset Hosts file to default.