• I’m in the process of migrating a Moveable Type blog over to WP1.2. So far everything has worked fine, but I’ve hit a problem with the permalinks.

    The old Movable Type permalinks are in the format:

    www.foo.com/archives/yyyy/yy/title.php

    title is restricted to 25 characters, and spaces are replaced with underscores.

    I’ve set up WP to use the same format of permalink and updated the .htaccess, but there are a couple of differences that are causing problems.

    The first is that WP replaces space in the post title with dashes rather than underscores; and the second is that there is no 25-character limit on the title within the URL.

    I’ve tried using Ryan Boren’s plugin, but that’s not retrospective.

    So my question is whether it’s possible to either hack the WP code that generates the permalink to force production of the permalink in an MT format; or alternatively tweak the .htaccess redirects to handle this?

Viewing 1 replies (of 1 total)
  • Thread Starter timd

    (@timd)

    OK, in case of future Googling, here’s what I did: changing the .htaccess to swap underscores for dashes seems to be a non-starter – according to people who know more about these things than me, it’s fraught with problems. So instead I:

    – hacked functions-formatting.php to change sanitize_title_with_dashes() so that it inserted MT-style underscores rather than dashes:

    $title = str_replace(' ', '-', $title); was replaced by
    $title = str_replace(' ', '_', $title);

    – ran a SQL query over the database to trim the post_name field down to a maximum of 25 characters:

    update posts set post_name = (left(post_name,25)) where 1=1

    – tweaked the .htaccess so that any inbound requests for old filetypes (.html, .shtml etc) were redirected.

    There didn’t seem to be any need to restrict future permalinks to 25 characters because they haven’t been Googled yet. So far all the Google hits for MT-style permalinks work, so it looks like this hack’s worked.

Viewing 1 replies (of 1 total)

The topic ‘Permalink troubles after Movable Type migration’ is closed to new replies.