Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried several attempts to resolve this, but all have come up naught.

Currently I have apache setup to forward all urls at and past the /portal/ tag to tomcat. Unfortunately, tomcat receives these requests through /portal/appName, a subdirectory in webapps rather than the webapps root directory where my wars are deployed.

Is there a simple solution to this that I'm not seeing? I've been trying to use mod_rewrite to ^/portal/ $ / but that doesn't yield the expected results (perhaps I'm doing this wrong?).

share|improve this question

With mod_jk you'll want to do something like this:-

RewriteEngine On
RewriteRule ^/(.*)$ /portal/$1 [PT]

The PT flag is needed so it Passes Through and hit's the JkMount stuff. This will rewrite everything to go to the portal context in tomcat, which is fine if you only have one application in tomcat, but if you start adding other contexts you'll need to add a RewriteCond. For full mod_rewrite documentation look at:-

You'll also need to add this to your mod_jk configuration

JkOptions     +ForwardURICompat

As with all thing in apache, whilst figuring out what's going on, logging is your friend:-

RewriteLog "/var/log/apache2/rewrite.log" 
RewriteLogLevel debug
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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