views:

6

answers:

0

Hi,

I've set up everything and mod_rewrite works properly on HTML files but not on jsp files. I've got a front end apache using mod_jk to forward jsp request which are then served by tomcat.

My rewrite rule inside my virtual host (notice I use the PT flag to force mod_rewrite to forward to mod_jk):

RewriteRule ^/([\w\d]*).jsp$ /sb/jsp/$1.jsp [PT] [NC] [QSA] [L]

So I want anyone accessing mydomain.com/index.jsp to be rewritten to /sb/jsp/index.jsp

I'm getting the following message in my rewrite log:

(2) init rewrite engine with requested uri /index.jsp applying pattern '^/([\w\d]*).jsp$' to uri '/index.jsp' (2) rewrite '/index.jsp' -> '/sb/jsp/index.jsp' (2) forcing '/sb/jsp/index.jsp' to get passed through to next API URI-to-filename handler

instead of being served the /sb/jsp/index.jsp file I'm actually being served with the $CATALINA_HOME/webapps/ROOT/index.jsp file. This tells me that mod_rewrite does not actually rewrites the URL, although logs it off as it did.

I can access /sb/jsp/index.jsp directly with no issue.

Another thing I just noticed. If I take the PT flag out I get a different message in the log: (1) go-ahead with /sb/jsp/index.jsp [OK]

And again I'm served with /index.jsp instead of /sb/jsp/index.jsp

So seems like apache is forwarding to tomcat but not the rewritten URL... Anyone has any idea? I had the same issue on my Linux server but when adding the [PT] flag this was solved. I'm now setting this up on Solaris and bumped into this issue...

Thanks!