home

mod_rewrite voodoo

When they said mod_rewrite was voodoo, I didn’t believe them. Now I do.

I’ve finally come up with something decent to convert my old movable type’s permalink structure to a new one that is compatible with my static pages in the root directory, and the archives in an archive directory.

The kicker is that for each post I used to store in an archive directory, I simply do a query on the current site on just the category — I couldn’t narrow down post because they both parse postnames differently: movabletype used underscores _ , while wordpress uses - dashes.

The rule that did it in the archives directory:

# migration from seebq.com

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=80]
RewriteRule ^(.+)?/(.+)?$ index.php?category_name=$1 [QSA,L]

Leave a Reply

Type the word "seebq" here: