Improved URLs

by john on January 13, 2003

Long on my todo list for this site has been moving to an improved URL model. just isn’t good for anyone, especially someone like me trying to read my logs! is just so much better.

I was up way too late last night making the switch. Originally I had thought I was going to have to maintain a permanent mapping file with mod_rewrite but was pleased to learn from Zen Haiku that you can leverage an existing MT feature to make it happen.

The move went very slick, the only coding effort I had to undertake was in modifying a recent feature I enabled, Recent Comments, which I found at Burningbird.

Here is the anchor from Shelley’s original code which works with default MT URLs:

<a href=”<$MTBlogArchiveURL$><$MTCommentEntryID pad=”1″$>.html#comment<$MTCommentID$>”>

And here is the change I made to enable it to refer to the “nice” URL:

<a href=”<$MTBlogArchiveURL$><MTCommentEntry><$MTEntryTitle dirify=”1″ $></MTCommentEntry>.html#comment<$MTCommentID$>”>

Where mod_rewrite comes in to play is in maintaining mappings to old URLs that may still be referenced somewhere out there in Google land. The first rule of a good URL is to make it never go away. Unfortunately I have not been able to get mod_rewrite to work. It’s working on my test box but not on production. No biggie because until I get it working I can maintain the old html files, but I hate when I can’t get things working.

Previous post:

Next post: