Support » Installing WordPress » Redirect loop after server move

  • Resolved justinwyllie



    The domain this is occurring on is:

    I have just moved the site from one server to another. I moved the files and the database. The database seems to be fine. I have tested the database connection is working.

    The issue I get is if I access I get a redirect (301) to then a redirect to then a redirect to . And so on. Until the browser gives up. You can see this best in Firebug.

    The issue is something to do with redirect_canonical.

    I am trying to trace through the PHP but it would save a heck of a lot of time if anyone knows what this is likely to be about.

    I have checked that the site url is correct in the options table.

    This is the only WordPress installation. This is not a ‘multi-site’ installation.

    With thanks

    –Justin Wyllie

Viewing 1 replies (of 1 total)
  • Hi

    (BTW I am on WordPress 3.2.2 not 3.4 as per the post. I couldn’t see until I logged on).

    Ok. If it helps anyone else here was the solution:

    1. In the file wp-includes/canonical I found the function redirect_canonical(). (About line 37). I hard-coded $do_redirect = false at the top of this function to prevent the redirects.

    2. Having done this I was able to log into the admin panel.

    I went to Settings… General and made WordPress Url == Site Url == (Before one said and the other

    3. I removed my hard-coded fix from redirect_canonical()/

    So. Essentially the problem seemed to be that my WordPress Url was not the same as my Site Url. But the tricky bit was because of the redirects I was being logged out and couldn’t see this.

    This can also be fixed in the wp_options table directly in the database but note that there are two fields involved. See the docs below.

    Another way of doing this is given here:

    As per that document it does look like I inadvertently made these 2 fields (Home URL and Site URL) different, and that was the root of my troubles.

    Hope that helps someone

    –Justin Wyllie

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect loop after server move’ is closed to new replies.