The Apache mod_rewrite module provides a nifty little way to redirect URLs by rewriting them on the fly at the server level. Whip together a little regular expression to parse the incoming URL, construct a new destination URL for it, and presto — seamless transition. So, for example, an old link to the RSS feed like . . .
. . . gets transformed on the fly to this . . .
. . . so I don’t think I’ll be breaking your feeds.
That’s all well and good when the incoming URL has the data you need. Unfortunately, Ten Reasons Why has gone through being originally hosted on Blogger’s blogspot.com way back in 2000, to being managed via Blogger but FTP’ed to an account on my at-the-time dial-up ISP Mindspring, to being hosted on tenreasonswhy.com through several different versions of Movable Type. And apparently, I wasn’t really very diligent about making sure the permalink approach was consistent among all of those changes.
A good number of the old posts in this blog have permalink URLs that, while based on the title of the entry, have been truncated in some fashion. For example, in some past version or configuration of Movable Type, the permalink URL for an entry titled “Wireless Saves The Day” became . . .
. . . but in WordPress that URL uses the full title, thus is:
. . . which is a fine and attractive URL, but finding a regular expression that will magically add those missing words is, well, impossible. Given only “wireless_saves.html” as the incoming location there’s no way to reconstruct “wireless-saves-the-day” out of that.
So, as a workaround, all of the old Movable Type permalinks (which are all distinguished by the “archives/” directory) now point to the monthly archive instead of to the individual entry. Therefore, the old MT permalink . . .
. . . will now automagically redirect to the archive page for the appropriate month here in WordPress-land:
For the most part, that shouldn’t be a major problem for actual users, since, except for a few years between 2003 and 2006, when I was really active, few months have more than a handful of posts. It’s going to hork up my referrer stats, but you don’t really care about that, do you? :-)
And, in any event, that’s plenty of thinking about regex for a sunny spring afternoon. Off to the outdoors!