3 min read

Moving from Drupal to Wordpress

This website began as a blog. And probably a badly made one as well. Hey, it was 2008, and I was trying to get my head around Drupal 6! Since then, I’ve moved half-way across the world, become a better Drupal and WordPress developer, and generally got into the habit of blogging a lot more.

Which is why it was time to move away from blogging on Drupal. After some consideration, I decided to migrate from Drupal to WordPress.

Why the Move?

Drupal is great for many things. Blogging isn’t one of them. I got sick of the extra time it took to upload images (WSYWIG and IMCE, sigh) and the horrible options for formatting in general. Ever since I’d been using WordPress as part of Johnny Holland, I’d been jealous. The final straw was setting up another domain on WP and live-blogging an event on it as the thought of doing it in Drupal terrified me.

Why WordPress?

There are a lot of options out there these days for writing. A lot of devs like file based systems such as Jekyll and Octopress. However, for me, the importance was ease of writing and adding media. WordPress is obviously streets ahead in this respect. While I’m really getting into Markdown, I can do without it for now as a payoff for easy media integration.

Migrating from Drupal to WordPress

A few points on the setup. I’m on Drupal 7 and migrating to WordPress 3.6.

Content

Not surprisingly, there’s a lot of ways to move content from WordPress to Drupal, but not much the other way around. After getting freaked out reading a number of posts which involved editing databases, I realised the easiest option was just to suck in the content on RSS.

I created a RSS file using the Feed view on Drupal. I then used the Multi-importer to link this to a post.

Note: in hindsight, I’d try to download the file, run bulk changes on image locations etc, and then upload it using the importer.

Images

Images involved a bit of cleaning up on the Drupal server, as imagecache created multiple versions. To play it safe, I copied all the original size files into one folder which I then moved into WordPress. I then used the Add from Server plugin to make them all be picked up in the Media Library.

But there’s a problem! Of course, the old images have the wrong links. I went into PHPMyAdmin and search replaced all old links.

SEO

As this was a slow transition, I moved the blog site from a folder to a subdomain. Once the site was working I used .htaccess redirects to match all old urls with the new ones (the mapping is pretty close anyhow).

Comments

I’d got annoyed with spam a while back on the Drupal blog so had already moved my comments to Disqus. Luckily, there are fairly easy ways to migrate the content over. Once I installed the Disqus plugin, it was a matter of choosing the best means to migrate. As my top level mapping system had changed slightly (from http://vickyteinaki.com/blog to http://blog.vickyteinaki.com), I could use auto-mapping, but as I’d attempted to map all old URLs to new ones, I could use the option of letting Disqus sniff out the 301 redirects.

Gotchas

URL mapping

I assumed that my simple naming system would mean that the URLs would easily map. I didn’t account for one thing. Drupal’s auto-naming URL system strips out a number of small words (‘the’, ‘of’), which WordPress leaves in. This unfortunately meant that I had to go through all of the posts and check for changes. I suspect that for a large amount of posts you would just have to do bulk changes or accept a drop in SEO.

Cleaning up the WSYWIG cruft

The only real disadvantage of pulling from RSS is that you get all the formatting that comes with it. For me that was the original Disqus scripts, and numerous divs from the original feed (though this probably could have been avoided if I checked my Drupal templates).

Linking it all Back

My original all-in-Drupal site included the latest blog posts on the home page as a View. How to do that now? Again, RSS. The Drupal 7 core Aggregator module includes a block for showing feeds (though I had to add a template extra, and suspect I’ll need to make a new view so as not to end up with content duplication/SEO issues).