An improved 404 handler
Les Orchard is thinking about moving from Moveable type to Pyblosxom. "I’ll just have to work out some way to redirect requests for ‘old’ URLs to the new content", he says. Which reminds me that a while ago I made some changes to my own 404 handler, and forgot to mention it here.
The improved 404 handler reads a tab-delimited file called moved.txt. The file has two columns - old file location, new file location. Requests for the old file will be redirected to the new one. The cool thing is that both old and new file can be regular expressions, so if you change the format of your archive pages from /archives/year_mo.html to /archives/year/mo/, you can just add a line to moved.txt like this:
/archives/(….)_(..)\.html /archives/\1/\2
The code is here: http://www.fettig.net/files/404-2.py.