Subdomain login problems
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
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
robots.multi pointed to the same directory as
multi. I signed in to
http://multi/wp-admin/ and set up sites at
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.)
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.