Q:

Hosts File not working correctly

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

localhost and whatever both work. However the others have weird behaviour.
Ping sub.localhost
c:\>ping sub.localhost
Pinging sub.localhost [127.0.0.1] with 32 bytes of data:

Ping example.com
C:\>ping example.com
Pinging example.com [127.0.0.1] with 32 bytes of data:

All seems ok, but browsing example.com will open the correct example.com page @ 192.0.32.10 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. example.com however still not working...
UPDATE 2:
Some more info...
C:\Documents and Settings\amatos>ping example.com
Pinging example.com [127.0.0.1] with 32 bytes of data:

C:\Documents and Settings\amatos>ping www.example.com
Pinging www.example.com [127.0.0.1] with 32 bytes of data:

C:\Documents and Settings\amatos>nslookup example.com
Server:   ac1.-------.pt  (# suppose this is the router address...)
Address:  192.168.202.2

Non-authoritative answer:
Name:    example.com
Address:  192.0.32.10

Thanks to all that have tried to help so far!

A:

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.

A:

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.

A:

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

Are you trying to visit www.example.com instead of example.com? There is a difference between both!
You should add www.example.com to the hosts file too if you want them both to forward to 127.0.0.1.

