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

tracking pixel

Is your website slow?

Enter its URL below to find out now:

About the Author

17 Comments on “Solved: WordPress Multisite Stuck in Infinite Redirect Loop After Upgrading to 3.9”

  1. 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? 🙂

  2. Oohhh dats how.. okay.. thanks..

  3. 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?

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

  5. 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’, ”);

  6. Thanks man. It worked for me!

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *