Yesterday I had the amazing idea to launch the WordPress 3.9 upgrade late at night, just minutes before going to bed. I thought “hey, maybe this fixes some major security issues I’m not aware of, I won’t take any chance”. Well to my great surprise, it totally broke the site!

It turned out that the website was stuck in a redirect loop going from “www.webhostinghero.com” to “webhostinghero.com/wp-signup.php?new=www” and back to “www.webhostinghero.com” continuously. It seemed like “www.webhostinghero.com” (with the www prefix) was now considered as a subdomain.

Fixing the Redirect Loop Issue For SubDomain-Based Installation

Using phpMyAdmin, access the wp_blogs table and replace the domain value of your main site from “example.com” to “www.example.com”:

MySQL WordPress wp_blogs Table

Next, open the wp_options table and make sure that both options “siteurl” and “home” are set to “http://www.example.com” (using the www prefix):

Wordpress wp_options table

Now you need to modify wp-config.php (which is at the root of your WordPress site) so that the DOMAIN_CURRENT_SITE constant matches the domain name you’ve set previously in the wp_blogs table:

define('DOMAIN_CURRENT_SITE', 'www.webhostinghero.com');

Finally, you must make sure that “example.com” redirects automatically to “www.example.com” by inserting these lines at the top of the .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^webhostinghero.com$
RewriteRule (.*) https://www.webhostinghero.com/$1 [R=301,L]

If you haven’t upgraded to WordPress 3.9 yet, I strongly recommend you perform these instructions before you proceed.

Multisite Subdirectory Install Problems

If you are using subdirectories instead of subdomain, there is also a know bug that breaks WordPress Multisite when upgrading to WP 3.9 if the subdirectory path contains uppercase letters. You can track this bug here: https://core.trac.wordpress.org/ticket/27866

There’s also a list of known issues with WordPress 3.9 here: https://wordpress.org/support/topic/wordpress-39-master-list?replies=4

Is your website slow?

Enter its URL below to find out now:

About the Author

Comments

  • Nice 🙂

  • Stefan

    You made my day. Thank you very much! I’d like to get rid of my multisite installation. Is this as easy as your article above? 🙂

    • unibrain

      I’ll second that. Thank you.

  • Pingback: WordPress Multisite Infinite Redirect Loop After Updating to 3.9 - The St. Louis WordPress Community()

  • Oohhh dats how.. okay.. thanks..

  • Stefanie

    I don’t see “home” in my wp-options table and, while the the other changes got the redirect error resolved, now I get an error on my login page (ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.) Cookies are enabled but I still can’t login. I keep getting errors when trying to manually add “home” to wp-options table. Any advice?

    • Have you done a search for “%home%” in phpMyAdmin? Because it pretty much has to be there:

      wp_options > Search tab > option_name LIKE ‘%home%’ > Go

      What’s the URL of your website?

      • Stefanie

        Oh ok, I see it now. And it is set to http://www.aussiefit.net. I am having to add this line to my wp-config file to be able to login define(‘COOKIE_DOMAIN’, false); but I am not sure if that leads my site open for any vulnerabilities or anything like that…

      • Stefanie

        Oh I figured it out! Silly me: I included “http://” in the following line. Once removed I no longer get the cookie error!

        define(‘DOMAIN_CURRENT_SITE’, ‘www.webhostinghero.com’);

  • Adele

    You are a legend! Have been looking for this solution for days, it works perfectly 🙂

  • dawesi

    people should also use this:

    http://tommcfarlin.com/resolving-the-wordpress-multisite-redirect-loop/

    In your wp-config.php file, add the following lines of code:

    define(‘ADMIN_COOKIE_PATH’, ‘/’);
    define(‘COOKIE_DOMAIN’, ”);
    define(‘COOKIEPATH’, ”);
    define(‘SITECOOKIEPATH’, ”);

  • mp

    Thanks man. It worked for me!

  • Andy

    You absolute legend. This was the fix I needed after hours of searching. Thanks so much.

  • Julian Kingman

    FYI, the reverse solution also worked for me (removing the WWW), thanks for the hints in the right direction.

  • Pingback: Quick Tip: Problems After Upgrading WordPress? Try Some of These Suggestions – Just Keep Learning()