10

everyone

I made a web application by Apache Click Framework, and just throwed it into tomcat behind httpd.

(assume my domain name is www.domain.com.) So I can access my app by the URL: www.myDomain.com/myApp/pages/login.htm

My questions is, how to remove the "myApp" part in this url by configuration in httpd or tomcat? because my domain name already has some words like "myApp".

2

2 Answers 2

8

Simply name your war file root.war and deploy it to tomcat. You probably have to remove the preconfigured ROOT/ directory in tomcat first, if it exists.

6
  • Thanks, sounds quick but... dirty. Dec 6, 2012 at 8:29
  • It is the standard way, as only one application can be root. No need to reconfigure Tomcat, works on any installation out of the box. Works also on Jetty, btw. Dec 6, 2012 at 8:34
  • Got it, will try. but is this OK for httpd? I mean proxy to tomcat part: "proxypass / /usr/local/tomcat/root" Dec 6, 2012 at 8:37
  • You mean ProxyPass / ajp://localhost:8080/, I guess? Works. Dec 6, 2012 at 9:17
  • 3
    I had to rename to ROOT.war (using all caps). Using root.war did not work for me. Oct 23, 2017 at 17:49
3

You need to do URL rewriting which most of framework supports like struts, spring mvc, that you can configure in your web.xml in case of java web app

Please Check if you can do with tomcat server.xml in below way ( But I am not sure with this, URL rewriting will solve your problem)

Refer: http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html.

etc/hosts to add something like below

127.0.0.1 mydomain.com

server.xml changes

<Host name="bbstats.localhost" appBase="webapps/myapp"
      unpackWARs="true" autoDeploy="true"
      xmlValidation="false" xmlNamespaceAware="false">
</Host>


<Context path="/myapp" docBase="bbstats" debug="5" reloadable="true" crossContext="true"> 
</Context>
1
  • Good idea Pal, I usually just throw the .war file to the tomcat webapp directory and let it do the rest. I never tried to modify the tomcat config file cause I don't what that mean. I will check your way. and BTW, the URL rewriting must be supported by the framework for using it? Dec 6, 2012 at 7:53

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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