WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Redirect loop after server move (2 posts)

  1. justinwyllie
    Member
    Posted 7 months ago #

    Hi

    The domain this is occurring on is: thenewobserver.co.uk

    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 http://thenewobserver.co.uk I get a redirect (301) to http://www.thenewobserver.co.uk then a redirect to http://thenewobserver.co.uk then a redirect to http://www.thenewobserver.co.uk . 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

  2. justinwyllie
    Member
    Posted 7 months ago #

    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 == http://thenewobserver.co.uk. (Before one said http://www.thenewobserver.co.uk and the other http://thenewobserver.co.uk).

    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.
    UPDATED:

    Another way of doing this is given here: http://codex.wordpress.org/Changing_The_Site_URL

    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

Reply

You must log in to post.

About this Topic