Blosxom and mod_rewrite

Using Blosxom as a

weblog engine is working out quite well. The biggest hurdle was in

creating friendly URLs. I didn’t want the address for my blog to be

https://jackbaty.com/cgi-bin/blosxom.cgi. Once again, Apache’s

mod_rewrite solves the problem. Here’s the snippet from the .htaccess

file…

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ cgi-bin/blosxom.cgi/$1 [L,QSA]

It works by checking the filename requested by the browser. If the

filename does not point to a file or directory, it rewrites the url by

prepending “cgi-bin/blosxom.cgi” to the requested document. So, if I

type https://jackbaty.com/some_story.html, the server actually serves

up https://jackbaty.com/cgi-bin/blosxom.cgi/some_story.html, which is a

valid blosxom URL. Neato, eh?

By the way, I found the above technique in the blosxom faq,

but I thought it was worth repeating.