So you want to see what it is about WordPress that makes it Movable Type's equal? This guide will help you with all the information you need to migrate your weblog from Movable Type (MT) or TypePad to WordPress (WP). We will use MT's exporter to export all the entries and comments in your MT blog and then import them using WP's import-mt.php importer. Finally, we will look at some issues concerning the preservation of links to articles (permalinks) after the import, and other issues that you may have. This guide will leave you feeling good, warm, and hopefully looking forward to a new life full with open source goodness. If you are a TypePad user, then read "TypePad" wherever this guide talks about "Movable Type". The process of exporting entries from a TypePad blog will be different, and you should contact the TypePad support folks if you are in doubt.
To begin with, the following are assumed:
The steps involved in the migration are as follows:
1. Open the file "import-mt.php" in your favourite text editor. You will find it in the directory "wp-admin/import/" in your WordPress installation . For this, you have to download it first.
2. On line number 2 of import-mt.php, find
define('MTEXPORT', );
and change that to
define('MTEXPORT', 'import.txt');
3. Save import-mt.php and upload it to the "wp-admin" directory on your server, overwriting the existing "import-mt.php".
4. Upload the "import.txt" file you had saved earlier after the export to the "wp-admin" directory on your server.
If you don't have administrative control of the server (root access), then Importing a Large Number of Posts has relevant links and help. This should be helpful if your import process dies before completing the import. The php installation on your webserver may have a low script timeout, or if the file is too large, your server may run out of memory. This is what's happening when you see a blank, white page, during the import, or your browser says "Done" before WordPress says "Have Fun!" after the import.
If you do have root access to the server, edit php.ini and increase the maximum memory setting. For a large import (e.g. 5MB), increase the script memory to 100MBs and restart apache. When the import is complete, restore the limit to what it was originally and restart apache again.
Search Engines such as Google will still link to the old Movable Type generated URLs when linking to your articles. This is true of other websites too, that may have linked to your posts or articles. It is your best interests to preserve those links, to prevent visitors following those links from seeing a "404: article not found" error page. The following steps will help you preserve the links, depending on how the permalinks were configured on your Movable Type weblog.
Alex King's solution provides a Movable Type template for individual entries, which you can use to generate pages that will redirect visitors to the corresponding WordPress pages. However, this method requires that you maintain the Movable Type installation, as also the pages generated by it, which will do the redirection.
Matt's method uses the .htaccess file for redirection.
Create a Movable Type template like the following, have it output to redirect.php in your WP root directory:
<?php require('wp-config.php'); header('Content-type: text/plain'); ?> <MTEntries lastn="999999"> Redirect Permanent /archives/<$MTEntryID$>.html http://www.example.org/archives/<$MTArchiveDate format="%Y/%m/%d"$>/ <?php echo sanitize_title("<$MTEntryTitle$>"); ?> </MTEntries>
If your entry IDs in MovableType are padded with zeroes (0), then change the line above to
Redirect Permanent /archives/<$MTEntryID pad="1"$>.html http://www.example.org/archives/<$MTArchiveDate format="%Y/%m/%d"$>/ <?php echo sanitize_title("<$MTEntryTitle$>"); ?>
Also, if your used the "dirify" option, for example, when in MT, if you had:
Use:
Redirect Permanent /archives/<MTEntryTitle dirify="1">.php http://www.example.com/index.php?s=<$MTEntryTitle encode_url="1"$>
or if the extension for the pages were ".html", instead of the ".php" above, use:
Redirect Permanent /archives/<$MTEntryID$>.html http://www.example.com/index.php?s=<$MTEntryTitle encode_url="1"$>
Apache 1.3 and above have a module, called mod_rewrite, that allows URL to be seamlessly rewritten on the fly by the server. This can be used to preserve the previous permalinks from a MovableType installation. To use mod_rewrite, the module must be installed and the FollowSymLinks option must be enabled for your blog directory. If these two conditions are true, then it's as easy as creating a .htaccess file with the following lines in it:
RewriteEngine on RewriteRule archives/0*(\d+).html /uri/to/blog/index.php?p=$1 RewriteRule index.rdf /uri/to/blog/index.php?feed=rdf RewriteRule index.rss /uri/to/blog/index.php?feed=rss RewriteRule index.xml /uri/to/blog/index.php?feed=rss2
If you are using WordPress 2.0 or newer, you will need to use Joshua Zader's solution: Mudita Journal: Importing from MT to WordPress
The information below largely pertains to older versions of WordPress.
If you want your imported posts in WordPress to have the same numerical post ids as in Movable Type, use Kathy's MT-Numeric-Id Importer. Note that this might not work very well, if you had "padded" numeric ids in Movable Type. However, a peek into the code, and a little familiarity with PHP should help you fix this, if required.
Another option is to use Dr. Bacchus' Solution for the same problem.
See also: http://scott.yang.id.au/2004/06/wordpress-migration-notes/
Allan Barizo provides a solution that forces Wordpress to use the same permalinks as Movable Type. However, since Movable Type does not always stick to a set number of characters in the entry_basename column, also known to WordPress users as a "slug" or %postname%," there are sometimes a few Page Not Found (404) errors. It is recommended that this method be used in conjunction with the strategies outlined above. It involves changing the permalink structure under "Options" to
/archives/%year%/%monthnum%/%postname%.html
Since the %postname% in Wordpress substitutes dashes for spaces, it may be desirable to install the Underscore Permalinks Plugin. You may wish to defer this in case the solutions below do not work.
Generally, a SQL Query must be run on the wp_posts table in the WordPress MySQL database. This is because every Movable Type installation has a different %postname% length cutoff point. (The cutoff point in Movable Type can be seen under Settings, New Entry Defaults tab, Basename Length for the value). On the contrary, WordPress displays the whole URL. Before running this SQL query, replace "15" with the number of characters in the Basename Length field for the particular MT installation. Remember, to back up your MySQL database before performing this operation.
UPDATE wp_posts SET post_name=SUBSTRING(post_name,1,15)
This query assumes that all of the posts in the database are imported from MovableType. Also note that any subsequent posts written or imported after running this query will follow the unlimited %postname% WordPress rule. In other words, this query will not have any effect on later post permalinks.
If the Movable Type blog is rather old, you may have upgraded Movable Type and changed it to use long URLs (more than 15 characters) for your entries. In this case, additional work may be needed. Let's assume that prior to September 1, 2005 your MT blog had a hard coded 15 character entry_basename limitation. You upgraded on September 1, 2005 and set the entry_basename limit to 50 characters. So an entry titled "This is a very long entry" written on August 30, 2005 had an entry_basename of "this_is_a_very" in Movable Type. (Movable Type will strip off the ending underscore.) This means that Page Not Found (404) errors when search engines provide these URLs. You may be able to fix many of these link errors by using phpMyAdmin to determine when the entry_basename size increased in your Movable Type MySQL database. Once you have determined the date then you can use SQL to fix all entries before this date to have the original 15 character limitation. Of course you don't want this change to affect those after this date. Example:
UPDATE wp_posts SET post_name=SUBSTRING(post_name,1,15) WHERE post_date < '2005-09-01'
There will likely still be inconsistencies. Some post_name values will contain a post_name ending in an underscore. This will cause page not found errors for these URLs. This SQL will clean up these posts, reducing but likely not eliminating this problem.
UPDATE wp_posts SET post_name = SUBSTRING(post_name,1,(length(post_name) -1)) WHERE RIGHT(post_name,1) = '_'
The next step is to change all dashes in the post_name field in WordPress to underscores. This can be done with this command:
UPDATE wp_posts SET post_name=REPLACE(post_name, '-', '_')
Mark D. Hamill wrote a utility that may help show the posts where the permalink is inconsistent between Movable Type and WordPress. It was tested using Movable Type 3.3 and Wordpress 2.3. You will need to save the file with a .php extension and change some script variables to match your instance of MySQL. Of course it must be placed on your server and run from it with an appropriate URL. Once bad links are identified they can be changed using phpMyAdmin or a similar tool by carefully editing the post_name column for the appropriate rows in the wp_posts table. Rerun the utility until no link inconsistencies are found.
If you created tags in your Movable Type blog and want to move them over, it is possible but tricky and possibly error prone.
First, make sure that you have all post permalinks preserved as in Movable Type using the guidance above. In order to move tags for your blog entries, there must be a way to find a Movable Type entry in WordPress and this can only be done if they have something in common. Ensuring the same permalink between Movable Type and Wordpress allows tags in Movable Type to be associated in Wordpress.
To actually move the tags, try a Movable Type tag import utility written by Mark D. Hamill. While it worked for him, it has not been extensively tested so send him feedback. It should be considered "Alphaware" so use it at your own risk and with the expectation that it might fail. Make sure you backup your database before trying to use this utility.
Read the utility's instructions carefully before running it. It was tested using Movable Type 3.3 and Wordpress 2.3 and may not work for other versions. You will need to save the file with a .php extension and change some script variables to match your MySQL database. Of course it must be placed on your server and run from it with an appropriate URL. Guidance on running the utility can be found by invoking it. When ready to actually move over the tags, add a ?run=1 to the end of the URL.
The following are a bunch of links to posts by users describing their MT to WP move. This might be handy to see if someone has faced the sinister problems you are facing (God Forbid!) :