If I try to access
127.0.0.1 or even my local IP address
192.168.1.14 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
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
127.0.0.1. But now neither of these work (as if it took time for caches to clear?!). And neither does
192.168.1.14 (my local IP).
Bizarrely I can still navigate to
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
192.168.1.14/xampp/, 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
127.0.0.1 directly does not work! The IPv6 (
::1) entry is commented out.
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
127.0.0.1 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 127.0.0.1 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.