Drupal localhost redirecting to www.localhost.com

14,222

Solution 1

The redirect is caused by Firefox not being able to get a good connection with the local server and then trying to "fix" the address. You can disable the behavior in Firefox as follows:

  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” from here

However that will not solve your underlying problem (local server isn't responding right), it will just get rid of really annoying behavior. There are several possible causes of this failure, the host file problem MatW suggested is a common cause.

In my case Drupal seems to be crashing Apache during certain page loads, which is hard to diagnose/fix when your browser keeps redirecting itself away from the page you need to refresh.

Solution 2

Have you checked your window's hosts file? Not sure about where it lives in Windows 7, but in XP it lives here:

C:\WINDOWS\system32\drivers\etc\hosts

Make sure there is an entry like this:

127.0.0.1       localhost

As a double-check, you may want to flush your PCs DNS cache. Go into the command line and type:

ipconfig /flushdns
Share:
14,222

Related videos on Youtube

AntonioCS
Author by

AntonioCS

PHP/JS Programmer. Also dabble in Java, C/C++ and c#.

Updated on April 22, 2022

Comments

  • AntonioCS
    AntonioCS about 2 years

    I am working on a drupal site which I checked out (svn) to my localhost.

    Now the problem is that when I go to:

    http://www.site.com

    it all works fine, but when I go to:

    http://localhost/work/site

    I get redirected to

    http://www.localhost.com/work/site

    I have ran the install.php script and all works great. It reinstalls everything but when I go to the main site the redirect occurs.

    I removed the .htaccess file, didn't do anything.

    I am using windows 7 ultimate 64 (also tried on winxp pro 32) apache 2.2, php 5.2.13

    Anyone know anyway to fix this?

    Thanks

  • Krunal Shah
    Krunal Shah over 10 years
    set those two to off means...? how can i set that..?