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

Mehul Mistri
  • 15,037
  • 14
  • 70
  • 94
Hetfield Joe
  • 1,443
  • 5
  • 15
  • 26
  • 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 – Rahul Agrawal Dec 06 '12 at 07:04
  • https://stackoverflow.com/questions/7276989/how-to-set-the-context-path-of-a-web-application-in-tomcat-7-0/51167549#51167549 – Kanagavelu Sugumar Jul 18 '18 at 05:27

2 Answers2

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.

Udo Klimaschewski
  • 5,150
  • 1
  • 28
  • 41
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>
Rahul Agrawal
  • 8,913
  • 18
  • 47
  • 59
  • 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? – Hetfield Joe Dec 06 '12 at 07:53