A little help for migrating to Typo

Posted by Scott Laird Thu, 17 Nov 2005 20:54:14 GMT

I just committed a minor new feature for Typo–there is now a route-of-last-resort that can generate HTTP redirects out of a database table. This is something that people have asked for for months, because it’s of the easier ways to keep old URLs working when moving to Typo.

At the moment, none of the converters know anything about it, so if you want to use it, then you’re going to have to do a bit of coding. I suspect that we’ll see patches within a few days that will help people make the jump. The basic code for adding a redirect is pretty simple:

  Redirect.create(
    :from_path => 'archives/000001.html', 
    :to => '/articles/2005/11/17/first-post')

This would be a bit cleaner if from wasn’t a reserved word in SQL. The from_path bit should be relative to Typo’s root, and shouldn’t start with a slash.

Unfortunately, none of Typo’s URL helpers are available inside of converters, but it shouldn’t be too hard to code this up. Send me mail if you need help.

Tags , ,  | 5 comments

Comments

  1. Steve Longdo said about 9 hours later:

    MySql doesn’t like the column name being “to” for some reason. It causes the migrate script to fail between versions 25 and 27. Not sure why this should be the case. Sorry to post a bug here…

  2. Kyle said about 21 hours later:

    Yeah, I’m experiencing the same issue.

  3. Scott Laird said about 22 hours later:

    Should be fixed in the latest trunk.

  4. Steve longdo said about 23 hours later:

    You rock Scott! I can confirm that the issue is resolved. I opened a ticket #532 on Trac that you might want to close. Thanks again!

  5. Jim Reverend said 13 days later:

    This feature will certainly come in handy. In fact, I can even see a nice little addition that would kick in when the permalink to an article was changed. At that time, the author could have to opportunity to setup a redirect automatically to handle any old links.

Comments are disabled