Redirects and Rewrites
Monday, May 17th, 2004Weird link of the day: Mean Kitty for Veronica
I ought to be doing some Boston blogging now that two guys can get married in the state of Massachusetts, but the truth is that Jemima has been geeking while Rome burns. I figure as long as we’re redefining words here in Mass., I can rewrite some URL’s for you.
So, I have the usual geek MT file structure in my moveabletype directory (with an extra e for character):
moveabletype/index.html (the main index) moveabletype/index.rdf (one of several RSS formats) moveabletype/archives.html (the MT archive index page) moveabletype/cat_anomaly.html (one of 20 or so category archives) moveabletype/2001_09.html (one of 40 or so monthly archives) moveabletype/2004/05/08/iq_by_state.html (one of 900 or individual entries) moveabletype/blogages/ (image directory for icons, etc.) moveabletype/templates/ (template directory)
The new WordPress virtual file structure is a bit different:
wordpress/index.php (the main index) wordpress/wp-rss2.php (the single RSS format) wordpress/category/anomaly/ (one of 20 or so category archives) wordpress/2001/09/ (one of 40 or so monthly archives) wordpress/2004/05/08/ (one of 900 or so daily archives) wordpress/2004/05/08/iq-by-state/ (one of 900 or individual entries)
So the question is, how do I redirect the first set of URL’s to the second set? I’ve seen advice out there for a few approaches involving PHP, JavaScript or mod_rewrite.
I decided to use mod_rewrite only rather than rebuild my thousand MT pages (never again!). I’ve been playing with it for a while now, and here’s my final answer: