7

I've edited my HOSTS file on my Windows 7 Ultimate PC to re-route a couple of URLs so that they point to 127.0.0.1, but after saving the file (and re-opening to verify the changes were written) and pinging them they still reply with the actual IP instead of being redirected to 127.0.0.1 as they should be. At least, that's how it worked in XP, Vista, etc. I even went so far as to restart my DNS service on the machine via services.msc; but no dice.

So - I would imagine that Windows 7 keeps the HOSTS file there for legacy purposes and doesn't actually use it anymore. Is there a way to make W7 pay attention to the HOSTS file? In the event that you can't do that, where would I go to edit where these URLs point to?

Thanks in advance!

-Sootah

Sootah
  • 619

5 Answers5

7

Alrighty guys, apparently Win7's hosts file is screwy in some way. If you copy the contents of the file and then paste it into a new txt document (Notepad), then go and delete the original hosts file out of Windows\System32\Drivers\etc followed by saving a new copy of hosts (in the etc directory, obviously) then it works.

I had this problem on both my Win 7 desktop as well as my laptop and the copy/delete/save new method worked on both.

Sootah
  • 619
3

I had the same problem and was due to Trend Micro Antivirus. Go to your network device, in the properties (where you can see the IPv4, IPv6, etc.) uncheck the checkbox for "Trend Micro NDIS 6.0 Filter Driver". Wasn't enought deactivating the firewall! If you have installed another antivirus solution check if it's interfering.

Víctor
  • 31
2

First, make sure your DNS Cache is empty:

ipconfig /flushdns

Then, go to the properties of your network device, in the advanced settings of the Internet Protocol you can enable the LMHOSTS look-up functionality, it should work if both were done; Windows 7 still supports the HOSTS file like in previous versions.

2

The user indicated he fixed the problem though properly overwriting the contents of the host file in notepad (https://superuser.com/a/245561/201262) However:

There's a lot of discussion going on related to why the user needs to copy the contents of the host file to a new text document, delete the old, etc.

None of that is necessary.

When editing the hosts file, you need to first run notepad as administrator, then open the hosts file. Doing so will allow you to edit changes without having to save to a new location and replace.

1

Changes in file: hosts wasnt working for me, since I had an automated configuration script turned on in my LAN Settings. Please turn off the config script and hosts changes should show up.

Anoop
  • 11