Wow, just wow!! So I recently changed my several standalone WordPress installs to a network. I ran across one problem with blanking out my MX entries that I discussed here. I logged on to Webmaster Tools the other day to find out I had thousands of errors in there. There was another aspect of changing over to a network I hadn’t considered, my permalinks. Part of it was due to how WordPress handles things and most of it was due to me being a bonehead!
I used my main blog as the main site in the network. I hadn’t given it much thought, I just went with that. I would recommend if you decide to convert a bunch of sites to a network, you use the one that can afford to lose traffic the most to being the main site. Had I thought things through, I might have even used some sort of dummy site as my main site to have the least impact.
See I use the domain mapping plugin for my sites in the network, so for all of the subsites, nothing changed with the permalinks. Once I set up each subsite, I just went in and changed the permalinks to %postname% and I was good. That is the setting I had in place for each site to begin with. I – wrongly – assumed it was that way on my main site as well. Here’s all the problems I caused myself on that main site.
First, I set that site up back in 2007 or 2008, at the time you couldn’t use %postname% as your permalinks setting. So I used date based. I later changed that to category/postname when things evolved to allow it. I remembered that when I changed permalinks, WordPress would redirect all my posts. I knew that by converting my main site to be the network main site, it would add /blog to my URL. I was cool with that so I didn’t bother removing it. Afterall, this was a blog, and maybe in the back of my mind I though WP would auto-redirect. Just to be clear – it doesn’t!
Well, I converted my main site and forgot to check the permalinks settings. By default, they set to date based permalinks. I imported all my posts and everything was good to go. I spent a week converting all my other sites into my network. Well, when I converted my main site, my URLs had gone from category/postname to blog/date/postname and Google crawled it all and indexed. A week later I realized my mistake, I didn’t want date based URLs, so I converted them to %postname% thinking that’s where they started, but on this site they had never been that way! I had also had an important event going on that I was blogging about during this time and decided I wanted to keep my URLs as they are now.
So where I was at. I had, in a month, gone from category/postname to blog/date/postname to blog/postname. Google was angry and I was confused! I still haven’t solved it how I would like… I’d like to have everything fixed in .htaccess for speed sake, but I don’t know .htaccess well enough and every attempt I make botches it thoroughly! Every attempt I make either gets me stuck in a loop or throws off the links for my subsites.
I had to install two plugins to make it all work, due to my limitations and the limitations of the plugins. I like the Redirection plugin, it’s pretty powerful. But I couldn’t make wildcards work with it. I also installed Simple 301 Redirect because that one handled my wildcards, but I couldn’t make my regex entries work right. In Simple 301 Redirect I could handle redirecting all the old category/postname to blog/postname redirects easily through wildcard entries. Same with the old category, tag, and date archives. In the Redirection plugin, I could use regex to redirect that week long mistake with blog/date/postname.
I think I have everything caught but I’ll continue to monitor Webmaster Tools. The date based mistake will go away with time and I won’t need to keep that redirect forever, but the change from category/postname to blog/postname will be forever. I have a Yourls install which I heavily use. Those links all go to old, very popular posts on my website that I want to maintain links for.
Anybody know how to handle this all in .htaccess?? Especially for the category/postname to blog/postname without affecting subsites in a network? That would be peachy!