Wordpress to Drupal migration experience

This post is not directly relevant to using Drupal in libraries, unless you run your library website or blog on Wordpress. However, I thought some people might be interested in hearing how my recent migration went.

I had been running Digitizationblog on Wordpress since the beginning (November 2004), and for the last few months have been planning to move it to Drupal. I like Wordpress a lot, but I've invested a lot in learning Drupal and wanted to reduce the number of CMSs I need to patch, upgrade, and configure.

Knowing that someone has written a wp2drupal migration module encouraged me to give it a whack. My plan was 1) install a vanilla 4.7 Drupal on a temporary subdomain on my web host (the migration module requires Drupal 4.7), 2) install the wp2drupal module, 3) perform the migration, 4) upgrade the Drupal to 5.3, 4) install and configure modules on the upgraded site, and 5) swap the temporary subdomain with digitizationblog.interoperating.info.

The procedure went pretty much as planned. The wp2drupal module's interface is quite nice. It uses four tabs to step the user through the migration process, with warnings about backing up the target (i.e., Drupal) database and other reasonable precautions at the appropriate places. You simply copy your Wordpress config file into the module's directory, go to the first tab, and follow the instructions. There are a number of options you can choose, such as importing users, setting up WP-to-Drupal URL redirects, etc. As soon as you have finished migrating, you are told to disable and delete the module.

All of my Digitizationblog posts and attached comments got moved over, with authorship, datestamp, and category assignments all intact. All three of my Wordpress pages got moved over as well. Two problems however: only three of my 40 or so users got moved over (my own user and two others, not following any pattern that I could perceive), and the URL alias/mapping option didn't work. So, I was left with a successful content migration but no users and no auto browser redirects. The non-migration of the users wasn't a huge deal since only about a dozen of the 40 had ever posted comments (the rest were lurkers). I installed the User Import module to migrate the dozen active users and left the rest behind, a purely arbitrary decision. The User Import module worked as promised. I actually spent more time getting a comma separated value file out of the Wordpress database using phpMyAdmin than importing the file into my new Drupal. The migrated users can now log into my new Drupal site using their old Wordpress credentials.

I'm a bit more worried about the loss of the old URLs, but may look into scripting this myself. In the short term I am trying to at least get the RSS feed URL from Wordpress auto redirecting to the Drupal equivalent. One consolation was how seamless it was moving Drupal from the temporary subdomain to the production one. No problems there.

I used wp2drupal a while

I used wp2drupal a while back and have had terribe results trying to get the old WP urls to map to Drupal.

The main idea was to use .htaccess with a RedirectMatch directive that sent anything that looks like an old WP url to a script.

I kept the old WP table with slugs and dates, so the script tries to match the date from the old slug with a blog post in Drupal with the same date.

The MySQL query goes:

SELECT node.nid from wp_posts
JOIN node on wp_posts.post_date_gmt=from_unixtime(node.created)
WHERE wp_posts.guid like '%oregonlibraries.net/staff/?$uri'
OR wp_posts.guid like '%oregonlibraries.net/staff/index.php/$uri;

I set $uri from %ENV{'REQUEST_URI'} (er, in Perl).

I never really got it working, I think because I couldn't set up the .htaccess rules to allow for all of the various formats of wordpress urls I used over those few years.

staff/?.*
staff/p=[0-9]*
staff/.*

Part of my problem is that staff/.* matches a lot of non-blog posts on the site.

I ended up making the drupal 404 page include a search box and, nowadays, if I remember to look, I check the error logs and add aliases for old posts in the URL alias module.

I would love for someone to improve on this idea and/or show me how to do it right!

Hi I'm looking at migrating

Hi I'm looking at migrating from wordpress to drupal 6, is there a version in the works that supports 6 or should I just try and modify the code for drupal 6 myself?

software reviews

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.