views:

554

answers:

1

Hello

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

+2  A: 

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.

skaffman
Thanks for your answer. I'll try that and post results. Note that I don't want a client side redirect, but a url rewrite.
cherouvim
Thanks a lot! PT (passthrough) is what I wanted!
cherouvim