0

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).

  • what is the content of your wp-config.php (leave out the DB and salt stuff)? – odinp123 Aug 20 '16 at 11:37
  • Hmm, when we had the redirct issue on our multi site we changed the content of the wp-config.php to what you have except we have DOMAIN_CURRENT_SITE uncommented. What happens if you uncomment that part? – odinp123 Aug 20 '16 at 18:39
  • also have you checked the urls in the database under wp_blogs – odinp123 Aug 20 '16 at 18:49
0

I never got to the bottom of this. In the end I backed up the site with Updraft, reinstalled Wordpress and restored everything from the backup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.