With Windows 7, why is an entry in the hosts file not working?
I updated some entries in the hosts file at C:\WINDOWS\System32\drivers\etc
. As a test, I decided to make Google point to 127.0.0.1
.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
::1 localhost
127.0.0.1 google.com
This works fine on Windows Vista, but not on Widows 7. When I type google.com
into my browser, it goes directly to Google's website.
I am not using a proxy server, and I think there might be some temporary DNS settings that need to be flushed, but I'm not sure.
Does anyone know how to fix this?
Solution 1:
You may have to restart Internet Explorer or Firefox, or whatever browser you are using.
Also, try going to command prompt and typing:
ipconfig /flushdns
Lastly, double check you are typing google.com in the address bar and remember that both google.com and www.google.com are completely different as far as DNS is concerned and you will need to add an entry for both.
Solution 2:
An addition to @wil's answer.
the spaces between the IP and the host name is so important under windows 7
127.0.0.1 localhost
Under vista, a tab works perfectly, but under windows 7, it seems that it must be 8 spaces
Solution 3:
I noticed it takes a certain amount of time to resolve on windows 7.
Also I only have one space separating "127.0.0.1 domain" and it works fine.
ipconfig /flushdns doesn't seem to make a difference just clear your cache and wait a few minutes it will eventually take effect.
if still have problems make sure you running notepad as admin when you edit file and saving.