RewriteEngine on
# redirect number-based archives to date/name/-based archives
# this has to be a rewriterule, else 000007.php will become 000007 instead of the correct URI
RewriteRule ^<$MTEntryID pad="1"$>\.php|<$MTEntryID pad="1">\.html <$MTBlogURL$>archives/<$MTEntryDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$> [R=301,L]
# strip .php extension of filenames
RewriteCond %{REQUEST_URI} \.php$
RewriteCond %{REQUEST_URI} !index.php$
RewriteRule ^(.+).php$ <$MTBlogURL$>archives/$1 [R=301]
# monthly archives are gone
RewriteRule ^[0-9]{4}/[0-9]{2}/index /archives/ [G,L]
RewriteRule ^[0-9]{4}/$ /archives/ [G,L]
redirect permanent /archives/cat_<$MTCategoryLabel dirify="1"$> <$MTBlogURL$>archives/categories#<$MTCategoryLabel dirify="1"$>
redirect permanent /archives/<$MTCategoryLabel dirify="1"$> <$MTBlogURL$>archives/categories#<$MTCategoryLabel dirify="1"$>
redirect permanent /archives/<$MTArchiveDate format="%Y_%m"$>.php <$MTBlogURL$>archives/<$MTArchiveDate format="%Y/%m"$>/