Migrate from Wordpress to Blogger

I've just finished moving my blog from Wordpress to Blogger.  The domain name has even changed to http://blog.sethladd.com to reflect my continued efforts to link my digital assets to my Name as Brand.

While Wordpress is an excellent blogging platform, their free offerings at Wordpress.com left me wanting more.  You are unable to run any Javascript widgets or code at wordpress.com.  This means you can't run Google Analytics or Google AdSense.  Wordpress.com also requires you to pay to configure a custom domain name for you blog.  Granted, it's only $10 a year, but if I can get everything I want or need for free, then I'll go that route.

The Blogger platform is a natural fit.  They offer free hosting, free domain name configuration, and let you control the HTML templates and insert Javascript.  They have lots of widgets ready to go, as well.  Blogger makes it easy to monetize your blog, too.  I was sold, it's off to Blogger!

Converting a Wordpress blog to a Blogger blog isn't actually that hard.  Wordpress lets you export, and Blogger lets you import.  The issue, however, is that the two platforms use different file formats.  As luck would have it, someone wrote a Google App Engine application to convert from Wordpress to Blogger.  I tried it, and it worked great for me!

The main issue, though, is that Wordpress and Blogger use different permalink (aka slug) schemes.  That is, the format for generating the permalink URI is different.  This makes a clean transition very difficult.

Being the good web citizen that I am, I wanted to try to keep all of my old links working.  I have some nice PageRank scores for a few of my posts, and I'd hate to simply destroy that content.  Therefore, I wanted to configure the appropriate HTTP Redirects to help users and search engines make the transition.

My first step was to configure Apache, my web server, to redirect users from the old blog to the new blog.  I changed the CNAME for my old blog domain name to point to an Apache I control (instead of wordpress.com).

The following is the Apache Virtual Host file used to redirect:



(btw, if you are reading this in a feed reader, I'm sorry you can't see the above embedded javascript snippet)

You can see that I am listening at the address which used to host my blog, and redirecting over to the new blog address. I make use of the awesome Apache mod_rewrite to handle the redirects. I also let user agents know if a resource is Gone, when I know there is no equivalent between Wordpress and Blogger.

You'll also notice the ErrorDocument line. This is the catch all handler, performing the bulk of the work. If the Virtual Host encounters a URI it doesn't know what to do with, it will ask the redirect-to-blogger.php script.



The above PHP code isn't the best in the world, but it attempts to convert Wordpress permalinks into Blogger permalinks. My tests show that for my modest collection of posts, it covers most of the cases.

I'm redirecting with an HTTP response of 301, which means the resource has permanently moved to a new location. This will hopefully tell user agents that they should no longer check the old link.

While Wordpress has more polish, the Blogger platform is very configurable and lends itself to easy monetization. I hope the work put into the redirects pays off, and search engines and people can continue to find both new and old posts.

See you on Blogger!

Popular posts from this blog

Lists and arrays in Dart

Converting Array to List in Scala

Null-aware operators in Dart