Thursday, January 25, 2007

Apache - mod_rewrite not working

Here's a pretty trivial case I faced; the resolution is interesting:

RewriteEngine on
RewriteLogLevel 3
RewriteLog /path_to_log/rewrite.log
RewriteCond %{REQUEST_URI} /somestring
RewriteRule ^/(.*)$ http://some.server.com/somestring/$1 [R]

If RewriteCond trigger /somestring conflicts with some tomcat JKMount setup (or other trigger like for instance WebLogic), make sure that the mod_rewrite library gets loaded AFTER mod_jk library.