Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the application name in URL? tomcat + httpd

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".

like image 903
Hetfield Joe Avatar asked Dec 06 '12 07:12

Hetfield Joe


2 Answers

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.

like image 68
Udo Klimaschewski Avatar answered Nov 14 '22 20:11

Udo Klimaschewski


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>
like image 2
Rahul Agrawal Avatar answered Nov 14 '22 21:11

Rahul Agrawal