I’ve posted a couple of times about the migration from MovableType to WordPress (and all the other moves that preceded it).
One of the things I discovered via the “Redirection” logs was that I was losing quite a bit of traffic due to some “anomalies” and differences between how the permalinks are currently set and how they’d been when the site was using MovableType.
While I might have wanted people and search engines to always refer to posts using something like:
domain.tld/postlocation/
a lot of them had picked up on the index page, so they’d got:
domain.tld/postlocation/index.html
While that was fine in MovableType and would work fine, it was causing me headaches in WordPress, as that was not how I’d setup the permalinks, nor did I want to set them up that way.
I’d also got a few posts that had a completely different URL structure to the rest of the site, which was odd and quite annoying, but again, as MT stored the posts as actual files it didn’t matter too much. In the worst case scenario two versions of the same post might be available – and duplicate content will beat a 404 error any day of the week in my book 🙂
I tried to fix these anomalies, but while I managed to get various wordpress plugins to fix the bulk of them I was still left with a bunch of errors..
So Niall came to the rescue. He’s a bit of a wizard with regular expressions and mod_rewrite
Here’s the two rules he added that fixed all my problems (or enough of them to keep me quiet – WordPress’ insistence on putting apostrophes back into URLs isn’t something I can fix easily!):
RewriteRule ^/blog/archives/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/ /blog/archives/$1/$2/$4/ [L,R=301]
RewriteRule ^/blog/([0-9]{4})/([0-9]{2})/(.*).html$ /blog/archives/$1/$2/$3/ [L,R=301]
Thanks Niall!
Related articles
- A Couple of WordPress Plugins and Tips To Help With Migration (michele.me)
- Site Revamp (Sort Of) (michele.me)
Leave a Reply