I just moved this site from Drupal 7 to WordPress 4.3. The times, they are a changing, and my work has been far more focused on WordPress than it has been on Drupal. So it made less and less sense to maintain a Drupal site. Also, for a relatively simple personal blog, Drupal’s capabilities and overhead were overkill for my purposes.
To migrate the content, I started with a clean, new WordPress installation, with only one user account. I used a variant of the Drupla2WordPress plugin to move the Drupal content. Installation of this plugin is not quite as straightforward as a typical WordPress plugin. First, download a ZIP archive of the plugin and place the contents of the archive in your new WordPress site’s plugins folder, then activate the plugin from within WP’s plugins admin interface.
If your WordPress and Drupal sites are on the same server, you’ll just need your Drupal database credentials. If you’re moving servers, it is probably easiest (and safest, compared to opening up mySQL ports to the world) to export a copy of the Drupal database using the Backup and Migrate module. Since I was changing servers, this is the approach I used. I created a temporary database on my new server, and then imported the dumpfile with mysql -u root -p temporarydbname < drupalsitedumpfile.mysql
.
Once your Drupal database is accessible, it's just a few clicks to get the content moved over. Note that Drupal2WordPress doesn't add a menu entry to the WP admin interface. To access the Drupal import, go to Tools > Import. In the list of import systems, you will see 'Drupal 2 WordPress'.
On the first import screen, enter your Drupal database credentials. You can leave the 'Database Prefix' field blank unless you used a specific database prefix for your Drupal database. After clicking on 'Proceed to Next Step', you can pick what content and settings to migrate. You will probably want to check 'Import Content'. If you don't import users, you can choose to have the content associated with a specific user ID (which is set to 1 by default). After clicking on 'Start Import', you should see the results of your Drupal content migrating over. Once it's done, you should have all your posts and pages migrated to WordPress, with the original metadata such as post dates, and terms (if you chose to import them).
Note that this migration DOES NOT import images or other media. You will need to move images over separately. Also, there is a strange side-effect from the move. If you edit a migrated post, when you save your changes, WordPress sets the post to be scheduled to be published on the post date, effectively hiding the post from public view. After I edited my posts (I updated the code highlighting with a new plugin, and I updated the links to my post images), I ran a mySQL query to set the posts to published: update wp_posts set post_status = 'publish' where id in (312, 310, 311);
.
Also, keep in mind that as part of the conversion from articles to posts, your post URLs will change. Drupal uses the domain.com/content/article-slug URL format. If you don't want to mess up your SEO and have any links to your pages 404, you will need to either create a custom WordPress permalink structure to add in the missing '/content/' (like this /content/%postname%/
, or use Apache or Nginx URL rewrite rules to redirect the Drupal links.
Since I'm running Nginx, and I believe that I won't be switching this site back to Drupal anytime soon, I added rewrite ^/content/(.*)$ /$1 permanent;
to the location / {}
section of my site's Nginx site configuration file to set up a permanent redirect of all old my old Drupal article links.