How To

Multisite Login Loop

Unravelling the login loop when you break WordPress Multisite.

Congratulations, you’ve decided to go Multisite and added in all your lines to your config file. You’re raring to go, and the last step is to log out and back in.

But you can’t.

You get to the login screen, enter your credentials, and the page just refreshes. What’s on earth is going on?

This is actually a pretty rare thing, and I was only able to reproduce it when I moved my site on the server. The fix is actually pretty easy, and there are three things to do.

1) Edit your wp-config.php.

Visit and get new salts/hashes. This should prompt your users to re-login and hopefully generate new cookies.

2) Dump your cache.

Sometimes, however, browsers are idiots and you have to flush the local cache. You shouldn’t need to dump caching plugins, since that doesn’t impact logins.

3) Delete your cookies.

I hate this one. Delete the cookies only for your domain if possible. Chrome hides this, but it’s doable for all sites.

4) Check your .htaccess

A lot of people miss this. When the directions say ‘Replace your .htaccess with this…’ what they mean is replace. And yet many people leave in the old WordPress rules. Remember to replace your .htaccess calls for WP with the correct one: Multisite .htaccess rules

5) Check your wp-config.php again

You need to have both define('WP_ALLOW_MULTISITE', true); and define('MULTISITE', true); in there.

But what if you have this problem on Single Site? Do the same thing, but if you’re using CloudFlare, go check your settings. They’ve been known to cause problems with this, due to handling of redirects. Me and a coworker wasted a couple hours on that, before someone else pointed it out.

Edited to add….

6) Kick wp-config.php in the butt

Tom McFarlin came up with added this to your file:

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

This kicks the cookies.