Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localhost is working but not 127.0.0.1 in windows 7

I am running xampp on windows 7. When I do http://localhost, I get the xampp welcome screen in my web browser but http://127.0.0.1 does not work. In my windows hosts file, I have uncommented 127.0.0.1 localhost but the problem still exists. I have checked to see if firewall is blocking anything but still no good results.

How do I resolve this problem.

like image 938
Delali Avatar asked Sep 03 '14 19:09

Delali


People also ask

Are localhost and 127.0 0.1 the same?

The term localhost is usually used to refer to the local computer with the loopback address 127.0. 0.1. As such, typing 'localhost' in the browser's address bar will connect with the device itself. The purpose of localhost is to serve as a domain name for 127.0.

How do I fix localhost not working?

Temporary Disable the Firewall Once you disable the firewall, navigate to localhost in a browser to check whether it connects. If localhost still refuses to connect, move on to other potential causes. Also, make sure to turn on the firewall once you have finished working with localhost.


1 Answers

Two or three shot in the dark guesses. This is how I would diagnose the issue.

  • It's possible that your web browser is resolving localhost on your computer to the IPV6 loopback address, ::1. Compare the results of typing http://[::1] and compare the results to http://127.0.0.1 and http://localhost to see if that reveals anything. As to why xampp is working on IPV6, but not IPV4 is another issue.

  • You might have a web proxy installed on your network and your Internet Options or browser settings is configured to use it. This will bypass DNS and the hosts file and send the request straight to the proxy. And the proxy server probably resolves 127.0.0.1 and localhost differently. This also applies to any sort of local proxy, internet speed-up software, anti-virus scanner, Fiddler, etc... Try going to Control Panel->Internet Options and select the Connections tab. Then select the "LAN settings" button. Make sure all the checkboxes are turned off on this dialog. Run the "Setup" button at the top of the Connections dialog just to be sure. See picture below

  • Disable the Windows Firewall and/or any other sort of Firewall software you may have. Just so we can rule that out. Any change?

  • But your BEST option will be to install Wireshark or Netmon and get a trace of http://localhost connection and compare that to the http://127.0.0.1 address. That should reveal something...

like image 73
selbie Avatar answered Sep 20 '22 17:09

selbie