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

I'm having some issues with my hosts file. localhost whatever sub.localhost

localhost and whatever both work. However the others have weird behaviour.

Ping sub.localhost

c:\>ping sub.localhost
Pinging sub.localhost [] with 32 bytes of data:


Pinging [] with 32 bytes of data:

All seems ok, but browsing will open the correct page @ which is not the expected behaviour... (obviously sub.localhost wont work at all)

Any ideas why this happens?

UPDATE 1: Removing Proxy Configuration from browser solved it for sub.localhost. however still not working...

UPDATE 2: Some more info...

C:\Documents and Settings\amatos>ping
Pinging [] with 32 bytes of data:

C:\Documents and Settings\amatos>ping
Pinging [] with 32 bytes of data:

C:\Documents and Settings\amatos>nslookup
Server:  (# suppose this is the router address...)

Non-authoritative answer:

Thanks to all that have tried to help so far!

share|improve this question
What version of Windows are you on? – Hello71 Aug 12 '10 at 15:53
hosts has and you say "browsing, will open the correct page @ ", this doesn't sound right to me. – bryan Aug 12 '10 at 16:03
Windows XP; @bryan, what exaclty doesn't sound right? – acm Aug 12 '10 at 16:05
@acmatos: I'm with Bryan - you appear to want to go to, yet you also say that when it goes to, that is 'correct'. Which do you actually want? – boot13 Aug 12 '10 at 16:31 is the correct IP of By "correct" he means "registered in the normal DNS hierarchy". – Andrew J. Brehm Aug 12 '10 at 16:36

5 Answers 5

up vote 4 down vote accepted

Is your Web browser using a proxy?

Mine is (I am at work) and when I connect to a Web site it seems to use the address the proxy server thinks, not the address my computer thinks.

share|improve this answer
Yes, I'm using an automatic proxy configuration. Shouldn't the host file be checked before the proxy?? Disabling the proxy will make sub.localhost work but not the One step in the right direction! :-) – acm Aug 12 '10 at 16:58
The proxy works on a higher layer than the hosts file. Your browser never connects to the target, the proxy server does. – Andrew J. Brehm Aug 12 '10 at 17:27
I will accept this answer because it was the most helpful and proxy issues are most likely to be causing my problem. Thanks. – acm Aug 16 '10 at 10:55
This saved me a lot of time. Thanks a lot. – ClassCastException Jan 22 at 12:18

Flush your ARP cache:

  1. Open a cmd window.
  2. arp -a will show all of your ARP entries.
  3. arp -d will delete the entries (or a specific one).

I would also flush the DNS entries:

ipconfig /flushdns
arp -d

ping <whatever>
share|improve this answer

You said opens - it should go to, so either you wrote wrong or the hosts file is not being applied correctly.

I am not sure about the issue, but for the others, I would say that if ping is working, they are working fine, so simply double check that the webserver you are using has the host headers (or whatever setting on your server) set up correctly.

Edit -

Unsure why this is happening, First thing I would try is a different browser such as Firefox as this has it's own network settings which should not be affected by other system settings. If this solves it, then go back to IE and on the last tab (Advanced), choose Reset to remove anything else that may be setting this.

next, you can try tweaking your priorities of what is checked.

Open up the Registry Editor and navigate to :


Look for HostPriority and make sure it is a lower number than DNSPriority. You can also change it to a lower number such as 5 to make sure it takes priority over everything else.

If it still is not working, I would just say to check things such as your spelling, but it is hard without seeing the machine in person.

share|improve this answer
everything is well written... checked a million times. localhost as well as whatever are being correctly interpreted and both open, so I think it's safe to say hosts file is working, right? – acm Aug 12 '10 at 16:35
@acmatos - You wrote " will open the correct page @" - I am confused what you said correct page then? Also, have you tried flushing your dns settings and/or rebooting the machine? – William Hilsum Aug 12 '10 at 16:48
Wil, I tried to clear that confusion in the original question coments. I tried both dns flush and reboot with no success... – acm Aug 12 '10 at 16:54
@acmatos - updated. – William Hilsum Aug 12 '10 at 17:36
Hello Wil, thanks for the effort however still no changes... I'll update OP with some more info. – acm Aug 13 '10 at 8:24

UPDATE: Removing Proxy Configuration from browser solved it for sub.localhost. however still not working...

Are you trying to visit instead of There is a difference between both!

You should add to the hosts file too if you want them both to forward to

share|improve this answer
Agreeing with TomWij, also consider that your browser may automatically add the "www." prefix to "" when you type it. So it's loading a different site from what you thought. – CarlF Aug 12 '10 at 20:32
Nop, that's not the problem, both and have been added to hosts file and there are no changes. – acm Aug 13 '10 at 8:14
Have you tried to use a different browser? This can help you to determine if it's only your browser or it is a system-wide problem. – Tom Wijsman Aug 14 '10 at 9:34

Try opening a command line (cmd.exe) and do ipconfig /flushdns and then restart the browser.

Also, I just got to ask since it might be too obvious or sound too stupid. Have you tried rebooting (or at least logged out and then logged in)? I never cease being amazed at what problems this can solve.

share|improve this answer
Thanks, did both (dns flushing and reboot) already, however nothing changed. Had my faith on reboot also. :-) – acm Aug 12 '10 at 16:39

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.