Migrating from Nucleus to Movable Type

My original blog was based what was available as a one click install when I set up the domain in 2006. Times have changed, and even though I don't intend to become a professional blogger, I do see value in building myself as a brand, and a well done blog is part of that. Nucleus may be great for some people, but I wanted to change hosting providers (I'm now at Dreamhost), and so I would need to at the very least reinstall, and at that point, it made sense to look around. I settled on Movable Type, and I'm happy with it so far. My decision was mostly based on the fact that I liked how well commenting worked on Bruce Scheier's blog. So, what do I need to do?

  1. Export the data from Nucleus
  2. Import the data into Movable Type
  3. Make sure external links still work
  4. Fix anyone subscribed to my rss feed

Export from Nucleus in Movable Type format

My starting point was a database dump from the old system. I imported this into my local mysql, and started looking at it and matching up fields to Movable Type import/export format. It's a pretty straightforward process. The comments must be matched up to the blog entries, and the date format is different between the two.

nucleus_export_mt.rb

Import into Movable Type

Once I went to all the trouble to export into the right format, importing was simple. Every item imported just fine. It seems I ended up exporting category numbers, so I had to go back in and rename my categories, but with only four items, this wasn't worth fixing the import process, it's easier to do by hand.

Make existing external links still work

inbound-links.png

One last problem was what to do with external links to individual blog posts. You can see what pages are linked to from outside using Google's webmaster tools. I wasn't able to find this exact information in such a convenient form in MSN Live search or Yahoo! As you can see in the image, I have only a handful of files with outside links. These are linking to the old index.php. Movable Type does not have a file index.php -- the url structure is different.

What I have done is create a very simple index.php that does nothing but forward old requests to the correct pages. It contains a hard coded list of these legacy outside links -- they are unlikely to ever change. If it recognizes the parameters as a request for one of these pages, it forwards to the appropriate page on the MT blog, using a 301 Moved Permanently. This will at least tell search engines that they should index the new location.

If the user didn't supply an understood argument to the script, either an item that I haven't covered, or maybe some archive page, I set status code 404 to indicate to search engines that this page isn't valid. I then redirect to the main page of the blog with a message and a three second delay. This gives visitors the best chance of finding what they want, but also gives them a heads up that they will have to look for it.

index.php

Fix the RSS Feed

I did the same kind of redirect as above, but this time I'm redirecting anything looking for xml-rss2.php to atom.xml. xml-rss2.php. This definitely worked for FriendFeed, still waiting to see if Google Reader picks it up.

Incidentally, every web developer should at least know where to look for HTTP Status Codes. No need to memorize it, but be aware that sometimes subtle difference matter.