Drupal localhost redirecting to www.localhost.com

后端 未结 4 720
我在风中等你
我在风中等你 2021-01-06 01:57

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

相关标签:
4条回答
  • 2021-01-06 02:27

    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.

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2021-01-06 02:35

    I finally found the reason behind this huge problem.

    It was the css and js optimization that was messing everything up. I set those two to off and then copied the database to the localhost version of the site and all worked out great!!!

    0 讨论(0)
  • 2021-01-06 02:36

    From the drupal sites/default/settings.php file:

    /**
     * Base URL (optional).
     *
     * If you are experiencing issues with different site domains,
     * uncomment the Base URL statement below (remove the leading hash sign)
     * and fill in the absolute URL to your Drupal installation.
     *
     * You might also want to force users to use a given domain.
     * See the .htaccess file for more information.
     *
     * Examples:
     *   $base_url = 'http://www.example.com';
     *   $base_url = 'http://www.example.com:8888';
     *   $base_url = 'http://www.example.com/drupal';
     *   $base_url = 'https://www.example.com:8888/drupal';
     *
     * It is not allowed to have a trailing slash; Drupal will add it
     * for you.
     */
    # $base_url = 'http://www.example.com';  // NO trailing slash!
    

    Try setting $base_url = 'http://localhost/work/site';

    0 讨论(0)
提交回复
热议问题