Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I updated some entries in the hosts file "C:\WINDOWS\System32\drivers\etc" to make google for example 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 under windows Vista, but not under Widows 7. When I type google, it goes directly to Google's website. For info, I am not using a proxy server.

I think there are some temporary DNS settings that must be flushed, but I don't know how, anyone knows how to fix this?

Thank you.

share|improve this question
Just out of curiosity, why are you doing so ? – Sathya Sep 27 '09 at 16:13
to show that pseudo-hackers that post videos proving they hacked a website is not true always :) – user3864 Sep 27 '09 at 16:57
this is why I did this :) martani.net/2009/09/bloginycom-is-hacked-google-too-video.html – user3864 Sep 27 '09 at 23:10

5 Answers

up vote 4 down vote accepted

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.

share|improve this answer
1  
very common misconception about the www. I've see SO many sites forget to set domain.com to forward to their web server leaving ONLY www.domain.com working or visa versa. :) – Jeff F. Jan 14 '11 at 15:35

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

share|improve this answer
To be honest, I haven't really messed around with hosts file since moving to 7, (do it all at the DNS server). Good advice if accurate - +1 – William Hilsum Sep 27 '09 at 17:13
Unix requires any whitespace to be present. While not very surprising, Windows moving away from that format is kinda unusual. (I haven't tried Win7 myself.) – grawity Sep 27 '09 at 17:50
This is not accurate. I'm on Windows 7 Home Premium 64bit. I don't have time to test for tab or other number of spaces, but I have entries that work with 6, 7 and 8 spaces. – JannieT Feb 24 '12 at 10:09

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.

share|improve this answer

Here is what i did, when that all above solutions failed. go to: C:\Windows\winsxs Search for "hosts" for me it is located at: C:\Windows\winsxs\x86_microsoft-windows-w..nfrastructure-other_31bf3856ad364e35_6.1.7600.16385_none_045b589158ae90da\hosts

right-click it>> properties>> security>> advance>> owner tab change ownership to administrators, next change permissions of the file to full control to administrators group.

Edit the hosts file with the entries.

Disable chrome's dns pre-fetching as it could cache ip addresses of many sites. Also check your internet settings and disable any proxy servers you are using.

share|improve this answer

win 7 firewall control common domain name and does not override them with your hosts file.

so that localhost works, instead google.com no.

so just disable windows firewall service, and restart pc.

bye

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.