2

Tonight I installed a clean copy of WordPress on my local machine, with the intent of trying to set up a subdomain multisite installation. (I've got lots of experience using subdirectories, but this is my first time using subdomains.)

I set up the following hostnames in my /etc/hosts file:

127.0.0.1 multi
127.0.0.1 snoopy.multi
127.0.0.1 robots.multi

I installed WordPress and set up multisite as per the Codex's Create a Network page. I set up my Apache config so that snoopy.multi and robots.multi pointed to the same directory as multi. I signed in to http://multi/wp-admin/ and set up sites at snoopy.multi and robots.multi. Everything worked fine -- the new sites showed up in My Sites.

Only I couldn't log in to the subdomains' /wp-admin. If I entered the username and password that logged me in to the root site, I'd simply be redirected back to the login page. (Entering a bogus password did trigger the "can't log you in" message, though, which was weird.)

I did find a solution, and will post it as an answer here, in case anyone else runs into this issue. (That's kosher, right? I did a search to see if it had been answered before, but didn't find anything that sounded like exactly the same issue. If I'm wrong, please let me know.)

Edit

The solution below is apparently not a complete solution; I can log in to the subdomains' wp-admin pages, but now I'm unable to log in to the root site's wp-admin pages at http://multi/wp-admin . Any advice would be appreciated.

1

1 Answer 1

1

Google led me to this page: http://lauragentry.com/blog/2012/01/05/when-wordpress-network-subdomain-blogs-wont-let-you-log-in/

There's a chunk of code in there that I added to my wp-config.php file, to wit:

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

What I don't quite understand is why this works. Anyone know?

Updated It doesn't completely work -- I can now log in to the subdomains, but not the root domain.

4
  • If you're still looking for an answer have you considered adding a bounty to your question?
    – user9447
    Jul 8, 2016 at 3:47
  • If I recall correctly (and there's no guarantee of that; this was 3+ years ago) the eventual solution was "wipe and reinstall", which wasn't that big a hardship because this was a local test installation.
    – Pat J
    Jul 8, 2016 at 12:51
  • Then can yoi accept your own question?
    – user9447
    Jul 8, 2016 at 13:09
  • I'd have sworn I did. Whoops.
    – Pat J
    Jul 8, 2016 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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