http://localhost/ redirected to www.localhost.com


Recommended Posts

I don't know what just happened but all of the sudden http://localhost just stopped working. I have Apache 2.2 installed for some time now (over a year) and everything worked fine until right now. It was working 30 minutes ago and now it's not.

Firefox:

I go to localhost or http://localhost and I get redirected to www.localhost.com. At least that's what is shown in the status bar but the address bar doesn't change. Putting 127.0.0.1 works just fine.

IE:

I go to localhost or http://localhost and it says it can't open the page. Putting 127.0.0.1 works just fine.

Opera:

Works fine...

My hosts file seems to be ok (using Vista) and I have no idea why this just happened and how do I fix it.

Any hints?

Link to comment
Share on other sites

try restarting apache.

if your web browser went to localhost.com i would imagine that would be because it didnt find anything at the actual localhost and so it started cycling though the extensions to find a valid one (it will do this if you misspell a url) and found the .com

Link to comment
Share on other sites

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#	  102.54.94.97	 rhino.acme.com		  # source server
#	   38.25.63.10	 x.acme.com			  # x client host

127.0.0.1	   localhost
::1			 localhost

Restarting the system or apache didn't solve anything. How come it didn't find anything in localhost? It was finding something before this started to happening out of the blue...

Link to comment
Share on other sites

@ziadoz

1) Didn't work (same thing happened). 2) where is that vhosts file?

@Colin-uk

ipconfig /flushdns didn't help it...

C:\Users\Nazgulled>ping localhost

@kingofthecarts

Pinging NAZBTM [::1] from ::1 with 32 bytes of data:

Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
	Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
	Minimum = 0ms, Maximum = 0ms, Average = 0ms

Link to comment
Share on other sites

^ from that it looks like the ::1 entry in your hosts file is the problem.

have you ried removing it and restarting?

maybe set it read only after you have changed it so that it cant be added again by anything.

Link to comment
Share on other sites

Well, it's working now and I didn't do anything that I haven't done before (I think).

When I saw the ::1 results from the ping, I decided to comment again the ::1 line in the hosts file and the flushed dns 3 times then I pinged again localhost and it said 127.0.0.1 so I tried to open the localhost on firefox and it worked. Then, I removed the comment on ::1 and flushed the dns a few more times in a row, pinged, tested in firefox and it still works.

Windows is just weird sometimes!

Link to comment
Share on other sites

::1 is the IPv6 address for localhost, ie loopback, if your NOT using IPv6 -- why would you have that entry in there? Is Apache listening on your IPv6 address?

If your not using IPv6, then why dont you just disable it -- there is little point to having it on, if you not using it.

http://technet.microsoft.com/en-us/library/bb878057.aspx

Disabling IPv6

Unlike Windows XP, IPv6 in Windows Vista cannot be uninstalled. However, you can disable IPv6 in Windows Vista by doing one of the following:

* In the Connections and Adapters folder, obtain properties on all of your connections and adapters and clear the check box next to the Internet Protocol version 6 (TCP/IPv6) component in the list under This connection uses the following items. This method disables IPv6 on your LAN interfaces and connections, but does not disable IPv6 on tunnel interfaces or the IPv6 loopback interface.

* Add the following registry value (DWORD type) set to 0xFF:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\DisabledComponents

This method disables IPv6 on all your LAN interfaces, connections, and tunnel interfaces but does not disable the IPv6 loopback interface. You must restart the computer for this registry value to take effect.

Link to comment
Share on other sites

  • 3 months later...

I have the same problem as nuzgulled but localhost never resolved for me.

I am running apache and 127.0.0.1 works fine!

Is there any solution to that?

BudMan solution works?

thnx!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.