It’s no secret that I’ve switched CMS’s so many times that it makes my head and my reader’s heads spin. Take a look at my CMS tag and you’ll see my struggles with Wordpress, Expression Engine, Text Pattern, and Blot.
I made a big migration to Jekyll and loved the static type of CMS’s ever since. Fast forward to today and I’ve pretty much settled on Pelican. Why? It’s a static CMS and its python powered. It does a great job of streamlining the YAML front end of a post and it’s fast to regenerate. The best part? I use rsync to upload new posts to my server and I use the S3 upload to make a backup of my site on Amazon.
Yet, there’s ONE big problem that I’ve noticed. 100’s of my inbound links are all now dead and that messes with my SEO ranking.
The solution is to create RewriteRules in my .htaccess file and here’s some friendly tips on how to do it.
Moving away from Wordpress
The biggest inbound link killer on my Wordpress site was when I switched my permalink slug. I went from a classic format of ‘/year/month/day/my-post’ to the simpler one ‘/my-post.’ Wordpress handles this change if you do it in Wordpress. If you migrate out of Wordpress, well all hell will break loose.
The simple fix is to add following regular expression to your .htaccess file:
RewriteRule /[0-9]+/[0-9]+/[0-9]+/(.*) /$1 [L,R=301]
What this does is select any /year/month/day/my-post formated URL and returns /my-post! Awesome, but what about those pesky /_wp-content/uploads directory? There are tons of images I put into my blog posts and now all those inserts don’t work.
The solution for me was to download the /wp-content folder and rename the folder as /_wp-content. I did this because I was using Blot.Im at the time and if I didn’t add the
_, it would generate 100’s of images as blog posts.
RewriteRule /wp-content/uploads/(.*) /_wp-content/uploads/$1 [L,R=301]
Of course, you don’t have to do this. You can move the /wp-content folder to its final destination and have all the links resolve.
**Moving away from Expression Engine **
Oh Expression Engine (EE) how I love and loathe thee. EE is a serious CMS. You can do a lot with it if you spend the time to architect it out. It’s powerful but complex. It’s too powerful for running a small blog like mine, but I liked it when I used it.
The thing with EE is that it creates /blog/entry/my-post permalinks. the /blog/ part is the name of the channel and it could be anything you like. It could be /radio/entry/my-post or /store/entry/my-post. For the extended time my blog ran EE, several inbound links went to /blog/entry/my-post.
To solve this problem I created the following rule:
RewriteRule /blog/entry/(.*) /$1 [L,R=301]
Now EE also had a URL for each category and that created havoc too. Wordpress uses this method too and since I use Pelican now, the categories have become tags, or rather ‘tag.’
The solution was this:
RewriteRule /category/(.*) /tag/$1.html [L,R=301]
Moving away from Blot.Im
Blot.Im is a favorite of mine. It’s simple to use and it’s making improvements with every update. Still, it’s not as feature rich enough for my taste. I’m sure one day it will be.
Blot uses ‘tagged’ instead of ‘tags’ and to solution to that is doing”
RewriteRule /tagged/(.*) /tag/$1.html [L,R=301]
The one thing that I haven’t done yet is rewriting changed permalinks. I’m editting my permalinks to remove any stopwords and I would need to update the .htacess file with 100’s of them. The Yoast plugin for Wordpress does this for you if you changed the permalink. That’s a wonderful thing and the solution for my problem lies in writing a python script.
While I ponder how to do that I will say that the simple changes above have already made an impact.