I've set up everything and mod_rewrite works properly on HTML files but not on jsp files.

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

I've set up mod_jk and I can access /sb/jsp/index.jsp with no issue. I would like to have users access /index.jsp and then be rewritten to /sb/jsp/index.jsp.

My rewrite rule (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]

Anyone has any idea what's going on? seems like the request is being forwarded but never gets to mod_jk.

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 the /index.jsp instead of /sb/jsp/index.jsp So seems like apache is forwarding to tomcat but not the rewritten URL...


  • RewriteRule ^/([\w\d]*).jsp$ /sb/jsp/$1.jsp [PT,NC,QSA,L] All my rewriter rules have the Flags in a single set of brackets for what it is worth..I had trouble with complex rules when I separated the flags. Oct 23, 2010 at 21:11
  • Thanks. Changed this to: RewriteRule ^/([\w\d]*)\.jsp$ /sb/jsp/$1.jsp [PT,NC,QSA,L]
    – user58052
    Oct 23, 2010 at 22:13
  • but still the same problem...
    – user58052
    Oct 23, 2010 at 22:14

1 Answer 1


^/([\w\d]*).jsp$ /sb/jsp/$1.jsp

Something does not look correct above.

Below is a rule out of my running config.

RewriteRule ^(.*)$ http://agent.hepmepls.com:8443$1 [R,NE,QSA,P,L]

This rule will take everything after the .* and wrap it around the URL I want....like this


But I feel like the $ and $1 are tripping you up...I could be completely wrong..but if you fire something though your rule would it not do the following..

  • Thanks Thomas. The problem here is that somehow mod_rewrite isn't forwarding rewritten request to mod_jk but rather the regular initial URL. If I replace the rewrite rule with a simple one, with no $ replacements I get the same problem...
    – user58052
    Oct 23, 2010 at 22:16
  • I tried to recreate your situation...I cannot fix it either..do let us know if you come up with a solution. Oct 31, 2010 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.