Sunday, May 07, 2006

mod_rewrite

The April issue of Sys Admin has a nice article ("Rock your Wiki") on using mod_rewrite. Such articles are part of the reason that I subscribe, even though I'm a programmer, not a sysadmin.

The first 2 or 3 times I tried to use mod_rewrite were failures. I wasn't even sure whether it was possible to do what I wanted with it. Eventually the necessity of adding RewriteCond's in order to set matching variables %1, %2, etc., not to make the rewrite conditional, became apparent.

Anyway, this article uses RewriteMap programs for their side effects. Probably a 'straightforward' mod_perl approach which added a handler to do the side-effect stuff and then DECLINED would be more obfuscated and less stable.
Also ... use [final] for efficiency.