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 have a Tomcat 7 running on CentOS.

Given is a configuration where I have my webapp "foo" placed in webapps/foo.war. I can access it without any problems using

Now I want to get access to the same webapp using a 2nd URL - "".

Setting up a webserver in front of my Tomcat is not an option so I need something like mod_rewrite for Tomcat.

What I have tried so far is to setup another context like this:

<Context path="/bar" docBase="foo"/>

At first it seems to work, but at the second look it shows that this isn't actually an "alias" - it is a second instance from my webapp which really is not a valid option for me.

So... does anybody know how to get some kind of aliasing or URL rewriting for Tomcat?

share|improve this question
up vote 1 down vote accepted

There is something similar to mod_rewrite for servlet containers called URL Rewrite. Taken from SO.

share|improve this answer
Same problem. Using this config I have two seperate instances from my webapp (and so I have 2 different instance from my cache...) – Pascal Schmiel May 2 '13 at 10:55
@pascal-schmiel I've updated my answer. – fuero May 3 '13 at 5:42
I've put all the stuff in my ROOT webapp, added my rewrite rule and it's working perfect - thanks! – Pascal Schmiel May 3 '13 at 14:12

You might be able to find (a few exist) or write a small Java web app that reverse proxies from one URL pattern to another. See

share|improve this answer

In your special case, what about setting a symlink in your webapps directory?

Asume your directory looks like this:

ls webapps/
foo  foo.war

Just add a symlink to foo with the name bar:

ln -s foo bar

Getting this:

ls webapps/
foo  bar  foo.war
share|improve this answer
looks like a great idea. sad news: with a symlink in my webapps directory I get a second webapp instance too ("bar" directory in work/Catalina/localhost/) – Pascal Schmiel May 3 '13 at 13:41

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.