The Information Bank


From MT to WP: Using the Same Permalinks as Movable Type

book mark From MT to WP: Using the Same Permalinks as Movable Type in del.icio.us Submit to del.icio.us | submit From MT to WP: Using the Same Permalinks as Movable Type to digg.com digg it! | submit From MT to WP: Using the Same Permalinks as Movable Type to slashdot.com Submit to Slashdot


Like I mentioned previously in the system overhaul post, I switched blogging software from Moveable Type to WordPress. Let me tell you, it was a lot of work! Luckily, I found many outstanding tutorials that told me how to properly convert my MT posts into WP posts. I found most of my information in the Wordpress Codex from Importing from Movable Type to Wordpress. (If you need any help doing the same thing, they have great links at the bottom of the latter page.)



Though, there was one huge problem that I met along the process. Movable Type has a different naming convention for their URLs then Wordpress. Movable Type’s nomenclature is something like this (at least, this is how mine works):

http://hostname/archives/year/month/15_character_basename_using_underscores.html

On the other hand, Wordpress uses something like this:

http://host/year/month/day/unlimited-character-basename-using-dashes/

Now, I could easily modify Wordpress to utilize permalinks just like my previous Movable Type installation. I just input this string into the “Edit Permalinks Structure” page (under “Options”):

/%year%/%monthnum%/%postname%.html

But there are two problems

Underscores
WordPress does not have a native way to switch the dashes to underscores in the permalinks. Luckily, I found a great plugin that does it automatically. It is located in the Wordpress Codex.

Basename Length
This was a harder problem to solve. By default, Wordpress leaves the basename length as the entire length of the title. So, if my title were

I Really Love to Eat Bananas in My Apartment Which is in New York on the Other Side of the World as China

Then the entire URL would be

http://blog.art-app.com/archives/2005/12/I-Really-Love-to-Eat-Bananas
-in-My-Apartment-Which-is-in-New-York-on-the-Other-Side-of-the-World-as-China.html

There were many solutions posed in working around this problem. But most of them pretty much suggested to program the Apache Rewrite engine to redirect posts. I didn’t want to do that. I wanted the WordPress URLs to be the exactly the same as my Movable Type URLs. Then, I read this obscure post from the WordPress Forums. It was an ingenious little idea of importing the Movable Type posts, and then changing the Permalinks by way of a mySQL query. This would then keep the permalinks of the imported posts the same as they were previously. But, any post that will be made by Wordpress will follow the unlimited character rule.

Run this sting the mySQL query interface (which is usually phpMyAdmin). Change 15 to the number of character you want in the basename.

UPDATE wp_posts SET post_name=SUBSTRING(post_name,1,15)

Remember to backup your databases before running this query.

Update
I checked my 404 error log (for non-existant-page requests) and I still found a few. Apparently, Movable Type randomly used 15 or 14 for my basenames. But, it may be different for your MT installation. Good Luck!

Subscribe to The Information Bank by Email | book mark From MT to WP: Using the Same Permalinks as Movable Type in del.icio.us Submit to del.icio.us | submit From MT to WP: Using the Same Permalinks as Movable Type to digg.com digg it! | submit From MT to WP: Using the Same Permalinks as Movable Type to slashdot.com Submit to Slashdot

Posted on Friday, December 9th, 2005

5 Responses to “From MT to WP: Using the Same Permalinks as Movable Type”

  1. Relentless Grace » Blog Archive » Changing to WordPress Says:

    [...] The WordPress Codex and The Information Bank have been extremely helpful in the process. [...]

  2. conto Says:

    i’m facing up the same situation, thanks for the great solution

  3. Richard Lee Says:

    In regard to MT basenames being set to 15 chars yet some basenames end up being 14 chars, it happens when the 15th char is a space which MT trims resulting in 14 chars ;)… Hmm yes such a relief moving to WP!

  4. Richard Lee Says:

    space or special char that gets stripped i mean

  5. Blogbody » Blog Archive » Switched to WordPress Says:

    [...] From MT to WP: Using the Same Permalinks as Movable Type [...]

Leave a Reply

© 2005 and web design of Allan Ray Barizo from [art] [⁄app].
This site is best viewed with FF and at least 1024x768 resolution.