Redirecting MovableType URLs to WordPress using mod_rewrite / .htaccess

After following the steps outlined here to import the old MovableType content, I created the following mod_rewrite rules to redirect requests for old content to the new archive copy of the site:

RewriteEngine On
RewriteBase /
    # Redirects individual posts:
RewriteCond %{REQUEST_URI} ^/weblog/archives/[0-9]{6}\.html.*$
RewriteRule ^weblog/archives/([0-9]+)\.html.*$ http://archive.tylerdave.com/$1/ [R=301,L]
    # Redirects monthly archives:
RewriteCond %{REQUEST_URI} ^/weblog/archives/20[0-9]{2}\_[0-9]{2}\.html.*$
RewriteRule ^weblog/archives/20([0-9]{2})\_([0-9]{2})\.html.*$ http://archive.tylerdave.com/date/20$1/$2/ [R=301,L]
    # Redirects individual posts:
RewriteCond %{QUERY_STRING} ^entry_id=([0-9]{1})$
RewriteRule ^mt/mt-comments\.cgi http://archive.tylerdave.com/00000%1/? [R=301,L]

    # Redirects old comments URLs to the posts:
RewriteCond %{QUERY_STRING} ^entry_id=([0-9]{2})$
RewriteRule ^mt/mt-comments\.cgi http://archive.tylerdave.com/0000%1/? [R=301,L]

RewriteCond %{QUERY_STRING} ^entry_id=([0-9]{3})$
RewriteRule ^mt/mt-comments\.cgi http://archive.tylerdave.com/000%1/? [R=301,L]

    # Redirects other requests to me-comments.cgi to the archive's home page:
RewriteCond %{REQUEST_URI} ^/mt/mt-comments\.cgi.*$
RewriteRule . http://archive.tylerdave.com/ [R=301,L]

    # Redirects the index page::
RewriteCond %{REQUEST_URI} ^/weblog/archives/index.html$
RewriteRule . http://archive.tylerdave.com/ [R=301,L]

    # Redirects RDF feed:
RewriteCond %{REQUEST_URI} ^.*index.rdf$
RewriteRule . http://archive.tylerdave.com/feed/rdf/

These rules account for more than 95% of the traffic to the old site. I will continue to monitor the logs and update the rules as necessary.

The Archive

I’ve owned the domain ‘tylerdave.com’ since May 1999.  I’ve used it for a variety of purposes (mainly email) over that time.

From 2002 to 2004 I kept friends up-to-date with my mundane goings-on using Movable Type.  When I originally decided to revive my blog I was going to just scrap the old content.  However after finding a number of my old posts still getting a decent amount of traffic I decided to archive the content in another installation of WordPress: archive.tylerdave.com

Thanks to Joshua Zader for his excellent instructions for importing form MovableType to WordPress while preserving the post IDs.   This will allow me to 301-redirect all of the old URLs to their new location.

All that’s left to do is some mod_rewrite trickeration so the old URLs map to the new locations and we’re all set!

Update: mod_rewrite rules for redirecting old ULRs