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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I try to access localhost or or even my local IP address the browser is unable to resolve this!? (Why it's even trying to resolve it I don't know - I didn't think it would need to?)

The browser is taking time to try and resolve this and eventually fails by attempting http://www.localhost/ (in the case of localhost).

Tried all browsers... Chrome, Firefox, Opera, Safari.

This was working OK! I have just installed XAMPP (Apache, MySQL, PHP, ...) and after installing I could navigate to localhost to see the default XAMPP welcome page.

localhost stopped working first, whilst I could still navigate to But now neither of these work (as if it took time for caches to clear?!). And neither does (my local IP).

Bizarrely I can still navigate to localhost/index.html, localhost/xampp, localhost/phpmyadmin, etc. But not the bare localhost. (Although I'm convinced I lost access to all bar localhost/phpmyadmin at one point!?). In the same way I can access and, but not

The webserver appears to be working OK. I can navigate to a local site I have setup in a VirtualHost and that works OK (just PHP, no DB).

'ipconfig /flushdns - reports that it was successfull, but no change.

Turning off the webserver makes no difference. (Without the webserver running it should immediately fail, but instead it still tries to resolve it.)

Turned off Anti-Virus and Windows Firewall - no difference.

Windows HOSTS file previously did not have an entry for localhost (even when it worked OK). I have added an entry for localhost, but this makes no difference. Like I mentioned above, even using directly does not work! The IPv6 (::1) entry is commented out. localhost

ping localhost works! And appears to correctly ping my local computer (the computer name is reported). So, why does this work, and nothing else?

I can create a VirtualHost with ServerName mylocalhost and add an approprite entry in my Windows HOSTS file to point to ie. mylocalhost and this works OK! (This displays the "Welcome to XAMPP..." homepage)

The default document (ie. DirectoryIndex) is setup OK.

This other question (from 3 years ago!) appears to have the same problem, but no good answers:
Cannot find local host via browser - can ping localhost and ok

In fact I have found numerous other references to localhost not working, but no answers. Some of these appear to be related to IPv6 conflicts, but I don't think that is the case here.

share|improve this question
What error message do you get when attempting to browse to localhost? Do you have any files served on localhost? Maybe tried localhost/index.html ? – Darius Feb 7 '14 at 10:44
@Darius: Nothing meaningful is reported by the browser, simply "This webpage is not available" (in Opera, and similar messages in other browsers). Yes, localhost should be serving files (the default XAMPP welcome message - which I did see from localhost when it was first installed). Bizarrely localhost/index.html does work (this is just an "It Works" message) and now localhost/xampp has started working again, as well as any localhost/XXX URL. But the bare localhost (or does not. – w3dk Feb 7 '14 at 11:05
@Darius: In fact I quickly setup a mylocalhost pointing to the same site (see question update) and this works OK. DirectoryIndex is setup to serve default files. (But localhost actually results in the browser trying to resolve it!?) – w3dk Feb 7 '14 at 11:06
up vote 0 down vote accepted

I cleared the browser cache! And it works!! (Oh, how I laughed... and cried!)

However, I don't think the fundamental cause was the browser cache. But that has indeed finally cleared the problem at the browser end!

localhost was working OK in the beginning. And then it wasn't resolving... in ALL browsers. It was at this point I fired up Safari (which I rarely use and should have been free of cache issues), and it didn't work in Safari either.

I then went round in circles flushing DNS (as Administrator), changing HOSTS file, VirtualHost config, changing DNS servers, reseting the TCP/IP adapter (netsh int ip reset resetlog.txt - - also see this other question: Ping myself, works with ipv6 not ipv4 in Windows 7), rebooting, etc. And eventually clearing the browser cache! So, one of the former "flushes" must have resolved it, but why it happened I still don't know!

One thing is for sure... the browsers were caching the hell out of the bad response. Firefox was still returning the entire failed response from my ISPs DNS long after I had changed the DNS servers on my network adapter. So the response I was seeing was impossible, which prompted me to clear the cache! -sigh-

And my HOSTS file no longer contains an entry for localhost - it is commented out - as it was originally, before this fiasco began.

share|improve this answer

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.