Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two webapps, prod-1.2.1.war and test-2.0.0.war.

If I put these straight into the "tomcat/webapps"-folder, they'll get deployed as;

  • hXXp://localhost/prod-1.2.1/
  • hXXp://localhost/test-2.0.0/

This works but really I would like them to show up as;

  • hXXp://localhost/vegshop/prod/
  • hXXp://localhost/vegshop/test/

As you see I somehow would like the "vegshop" to be included in the context path. I also would like the version-numbering to disappear without having to rename the WAR-files.

Thank you.

This is Apache Tomcat v6.0 under Linux 2.6, running SUN JDK 1.6.

share|improve this question

1 Answer 1

You can't include the include the /vegshop/ part in the URL like you want with Tomcat. Webapps are not mere files that can be placed where ever one wants. With Tomcat, /vegshop/ is either:

  1. a discrete webapp
  2. a folder under the ROOT webapp (the default, if there is no webapp.

The best you can do is something like be renaming your .war files. E.g. prod-1.2.1.war to vegshop-prod.war

  • http://localhost/vegshop/
  • http://localhost/vegshop-test/

If this /vegshop/prod/ thing is really, really important to you, then the only option I would consider is to proxy Tomcat with a web server (like Apache httpd) and rewrite the URLs. There might even be a way to code something wild with Tomcat, but all of this feels over the top for such a cosmetic change. Is it really that important?

share|improve this answer

Your Answer

 
discard

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