I've got an Apache and Tomcat running and I use mod_jk
to bind them. I have a Tomcat worker called "tc1" and the following setup on my VirtualHost
:
JkMount /* tc1
JkUnMount /*.png tc1
JkUnMount /*.gif tc1
JkUnMount /*.css tc1
JkUnMount /*.js tc1
That way Tomcat serves all requests apart the ones for static files.
Now I want to use mod_rewrite
and do something very simple such as:
RewriteEngine On
RewriteRule ^/foo$ /bar [L]
to rewrite the dynamic pageview at "/foo" to "/bar", but it doesn't work because all urls processed by mod_rewrite
do not end up into mod_jk
.
I've read the Apache Tomcat Connector documentation and tried all of the JkOptions
but nothing changed.
Does anyone know how to solve this?
Does the mod_jk
and mod_rewrite
load order and declarations ordering play any role in URL processing?
thanks
That's odd, because by default a RewriteRule
sends a client-side redirect, so the client should make a second request to /bar which should be caught by your JkMount
. Does your access log show show the request for /foo
and the the request for /bar
also?
Try this rule instead:
RewriteRule ^/foo$ /bar [PT,L]
The "PT" means "pass-through", and is a rewrite bodge which allows you to mutate the URL in situ and lets other modules get a look in, without sending a redirect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With