Now using mod_rewrite for blog urls

After reading a number of sites that discussed the use of Apache mod_rewrite I finally decided that it was time to try implementing this powerful technology.

I found the simple explanation given at was very helpful. I used the supplied rules to implement mod_rewrite for this blog.

Here is the .htaccess file currently being used:

RewriteEngine On
RewriteRule ^posts/(.*)/(.*)$ index.php?p=$1&c=$2
RewriteRule ^posts/(.*)$ index.php?p=$1
RewriteRule ^topics/(.*)$ index.php?cat=$1
RewriteRule ^archives/(.*)$ index.php?m=$1

I did end up hacking WordPress a bit to get it to write out my desired url format on its links. It looks like the current code has the option to do “search engine friendly” urls, but it is currently commented out. So I did a bit of searching for the places where the tags are written out and made some changes. 🙂

Eventually maybe I’ll work on the code some more so that the urls can turn into format (even more search-engine-friendly).

Just upgraded to the latest version in CVS of WordPress, and thanks to Matt have this functionality now built in. See this post for more details.