And still it doesn’t mean that it has been solved or is about to. With this post I’m writing today, with nearly two whole months of being absent from my awesome blog in English, I’m keeping my hopes up that I have for once solved this crap and never have to bother with multisite issues (MS rocks otherwise!), cookies, redirects and not getting access or getting angry or upset.
I’m using WordPress to do my blogging. No secret there. I have currently 4 blogs, and three of them are active. It’s this one, my Swedish one and the Swedish one about Great Danes. My website is just a basic website with my CV, and career updates and I also have created an archive of my old blog in Swedish, which contains of posts written since January of 2009 and has been made and moved through out basically all blogging platforms out there. Now it serves as an archive because here on WordPress, I’ve made the decision two years ago to never, ever change blogging platforms again. Tumblr is not an active platform either…
Caring for multiple blogs in a great way…
Ever since Multisite became a reality in 2010 with the 3.0 update, I’ve been using it pretty steadily whenever I’ve used WordPress as my platform. Now, it’s really useful because I have 3 active blogs that I like to update as often as possible. No matter what, I regularly login to my Swedish personal blog almost daily and with that I also check in on my other blogs to see stats, look for spam or other issues so I basically hop around a lot. Until I started this blog (again) which is on a whole ‘nother domain, this was not a problem at all. But, when I got this domain back, I thought that I’d of course would like to have my blog together with all the others in my multisite install. And then came the cookie issues…
Cookies, logins and redirects, oh my…
WordPress is awesome. It can handle multiple domains without a plugin, so no domain mapping is necessary. That’s indeed great! So far so good. Well. Not for long. It’s pretty simple to setup, just change the
site_url and you’re good to go. The issue is with cookies. Half-Elf has written a post on how to solve this and so have many others. I’ve tried basically everything, because since I seem to hop from blog to blog whenever I login to one of them, it’s a real frickin’ hassle to keep logging in to every, goddamn blog. I know it’s safer this way, but still. I’m like this close to ripping my hair out and throwing my computer out of the window due to sticky stuff like this. Me not like problems.
What I’ve tried in order to solve this mess…
- Everything in Half-Elfs’s post that I mentioned before.
- Created multiple networks with the WP Multi Networks plugin and moved this blog over there.
- Moved the blog to a separate WP install, once with separate database, another time with separate tables in the same WP install (with shared users table).
- Tested with other domains on a test install to change from subdomains to subdirectory and with that I also changed the
home_url, but kept a subdirectory url for backend purposes. This seems like the best way, but I hate the look of subdirectories…
- Trying as we write to only have this in my
wp-config.php file regarding cookies, with the blog being part of multisite and on the correct url everywhere (aka both home and site url are the same and everything else is as it should be for MS setup).
define( 'COOKIE_DOMAIN', $_SERVER[ 'HTTP_HOST' ]);
As of now, nothing has worked. It always has worked “for a while”. But after a few hours, days etc. it stops working. After the update to 4.6 my whole multisite install seemed to totally bug out. No matter what I did I had to login all the frickin’ time to even my subdomains! That was really annoying. And then I hadn’t changed a thing, except for the solution from Tom McFarlin! That solution, however, worked “somewhat”. It was a solution I could settle with. It meant that I could sign in to one of my subdomains once – and always be logged in to all my other subdomains, but whenever I had to access this blog on a separate domain, that’s when I had to login again. After the update to 4.6 this did not work so I had to start looking yet again for another solution.
With the plugin, I also added this to my
define( 'COOKIEHASH', md5( 'yourdomain.com' ) );
define( 'COOKIE_DOMAIN', 'yourdomain.com' );
define( 'ADMIN_COOKIE_PATH', '/' );
define( 'COOKIEPATH', '/' );
define( 'SITECOOKIEPATH', '/' );
define( 'TEST_COOKIE', 'thing_test_cookie' );
define( 'AUTH_COOKIE', 'thing_' . COOKIEHASH );
define( 'USER_COOKIE', 'thing_user_' . COOKIEHASH );
define( 'PASS_COOKIE', 'thing_pass_' . COOKIEHASH );
define( 'SECURE_AUTH_COOKIE', 'thing_sec_' . COOKIEHASH );
define( 'LOGGED_IN_COOKIE', 'thing_logged_in' . COOKIEHASH );
And I also added/changed this:
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'PATH_CURRENT_SITE', '/' );
define( 'DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST'] );
// Likely not needed anymore (your config may vary)
//define( 'SITE_ID_CURRENT_SITE', 1 );
//define( 'BLOG_ID_CURRENT_SITE', 1 );
// Uncomment and change to a URL to funnel no-site-found requests to
//define( 'NOBLOGREDIRECT', '/404/' );
* These are purposely set for maximum compliance with multisite and
* multinetwork. Your config may vary.
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] );
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] );
Now I’m just hoping that this setting has solved it. I do not believe so. Not in the long run at least. If it stays the same until tomorrow, I might be able to let this one go. When I think it is solved it means that I can continue to hop around to and from every blog without the hassle of logging in every time. If it works the way it usually does, it means that I can do this for a couple of hours, days or maybe just until I close my browser and try to login again to one of my blogs. Often, however I’m getting the redirect loop where it’s impossible to even access any dashboard and that happened earlier today. I just hope it was due to another mistake I made, regarding changing the site or home url. Everything at the moment is the way it should be, and that’s good. This blog doesn’t get any viewers anyways. 4 in one day is like totally amazing stats! But I’ve stopped caring about that. Or at least I try to…
I just really hope it stays this way now. The only dislike I have about every blogging platform out there (yes, even WordPress) are those tiny, little things that makes it difficult to get everything I want out of a platform. It’s all due to me of course being a noob, who hasn’t learned how to code. All I do is copy and paste. I have not learned the terminology and I have no idea what the Frick I’m talking about. All I know when I’m creating the snippets for my WP blogs is what I want the result to be. I’ve solved many issues and a lot of them are baked right into WordPress itself (i.e. Custom Fields, categories and tags). I’ve managed to create single posts whenever I post something on Instagram and shipping them over here, thanks to If This Then That and a simple trick using Jetpack’s Post by Email module. Amongst other things. Fingers crossed that this shit works now. Otherwise I’ll lose my mind a little bit more…