I’ve completed the migration, and I thought I’d pass along some accumulated knowledge. It seems that people have gone to a great number of contortions to make their MT URLs continue to work under WP. I believe I have a simpler solution. Just force WP to use the same ID numbers as you were using with MT. This involves making the following changes.
First, you need to edit the module that handles MT exports. This will be at lib/MT/App/CMS.pm
In sub export you’ll find a blob of text that starts with $tmpl->text(< <'TEXT'); and defines the template with which stuff will be exported. To that blob, add a new field:
ID: <$MTEntryID$>
No. Placement doesn’t matter.
Then you’ll need to edit import-mt.php. This is located in the wp-admin directory on your new WP installation. You’ll need to make the following changes.
@@ -225,6 +225,9 @@
case 'AUTHOR':
$post_author = $value;
break;
+ case 'ID':
+ $post_import_id = $value;
+ break;
case 'TITLE':
$post_title = addslashes($value);
echo ''.stripslashes($post_title).'... ';
@@ -277,9 +280,11 @@
} else {
$post_author = checkauthor($post_author);//just so that if a post already exists, new users are not created by checkauthor
$wpdb->query("INSERT INTO $tableposts (
+ ID,
post_author, post_date, post_date_gmt, post_content, pos
t_title, post_excerpt, post_status, comment_status, ping_status, post_name, pos
t_modified, post_modified_gmt)
VALUES
- ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_name','$post_date', '$post_date_gmt')");
+ ('$post_import_id',
+ '$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_name','$post_date', '$post_date_gmt')");
$post_id = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$post_title' AND post_date = '$post_date'");
if (0 != count($post_categories)) {
foreach ($post_categories as $post_category) {
In other words, you’re forcing the import to use the IDs that you want it to use.
Once you’ve done that, import the resulting export file, and add this to your Apache config:
# Movable Type -> WordPress fu
RewriteEngine On
RewriteRule ^/journal/(index.html)?$ /wordpress/ [PT]
RewriteRule ^/journal/archives/(.*?).html /wordpress/index.php?p=$1 [PT]
RewriteRule ^/journal/index.rdf$ /wordpress/wp-rss2.php [PT]
… of course, modified to reflect whatever URLs you happened to be using.