Despite being able to log in to all my multi-site subdomains, I was unable to access example.com > Network Admin > Dashboard.
I cleared all the cookies and attempted to login at www.example.com/wp-admin and got stuck in a loop with this URL:
http://www.example.com/wp-login.php?redirect_to=http%3A%2F%2Fexample.com%2Fwp-admin%2Fnetwork%2F&reauth=1
However, when I added www. to change it to:
http://www.example.com/wp-login.php?redirect_to=http%3A%2F%2Fwww.example.com%2Fwp-admin%2Fnetwork%2F&reauth=1
...it worked!
Why? And what do I need to change to make it work without manual intervention?
This is an existing site I recently changed to multisite with subdomains. My wildcard DNS entry works, though there were existing entries for both www.example.com and example.com in the DNS setup. Are both necessary if .htaccess is redirecting example.com URLs to www.example.com URLs?
wp-config.php is as follows:
/**
* Multi-site enable
*/
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
/* define('DOMAIN_CURRENT_SITE', 'example.com'); */
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
...and (from here)
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
define('NOBLOGREDIRECT', 'http://example.com');
I have installed WP MU Domain Mapping to allow me to redirect an external domain to one of the subdomain sites. When I enable Sunrise:
/* Turn on Sunrise for Domain Mapping plugin */
define( 'SUNRISE', 'on' );
I get the error message:
The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.
When I do so, I can log in to the main site, but not the subdomains (and neither can any of the users).