Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localhost lookup fails, browser tries www.localhost.com instead

I used to run web applications all the time on my laptop, no problems, I am using VWD 2008 Express, i have the latest framework, Windows Vista Home Basic...etc.. Now, when ever i try to run a website, or even chose to Show a Page in Browser from Within VWD, the browser (both IE and Firefox) keeps looking for www.localhost.com...

I tried to copy the address of and paste it directly in the title bar, nothing, same problem i tried to get that address from the balloon notification (the one that pops up when you run any ASP.net project), still nothing happens...

My colleague is facing the same problem, but for him, he can simply copy and paste the url in the address bar, but its not working with me....Heeeeeellllllllllllllllp

like image 786
Maen Avatar asked Mar 18 '09 08:03

Maen


3 Answers

Check your hosts file, it should be redirecting localhost to 127.0.0.1 and nothing else. The entry that will cause this error should look like this:

127.0.0.1    www.localhost.com 

If you find this, remove it or change www.localhost.com to localhost.

You can also try to post one of these in the adress bar:

127.0.0.1
http://localhost

Note that the hosts file is a popular victim of viruses, so if is has been modified, you might run a check on viruses.

Also see the discussion here.

like image 152
schnaader Avatar answered Sep 20 '22 13:09

schnaader


If that also doesn't work, open up nod32 (you probably have it installed on your system if the above methods don't work) go to advanced setup, on the left menu, select protocol filtering, and select HTTP and POP3 ports... ;)

like image 41
Subliminal Hash Avatar answered Sep 22 '22 13:09

Subliminal Hash


I got the same problem in firefox 3.6 when my server was down. In my case it was not a problem with etc/hosts where the line

127.0.0.1 localhost

was there and OK.

The solution that worked for me was to disable the "cleaver" URL fixing that Firefox carry out when the page is not found. The procedure taken from here:

  1. Type about:config in the address bar and hit return.
  2. find browser.fixup.alternate.enabled
  3. double click the “true” value. The line will become bold, and the value will change to “false”

This fix directly the problem. No firefox restart needed. If your server is down you get "page not found" as expected. Hope it helps.

like image 34
joaquin Avatar answered Sep 18 '22 13:09

joaquin