genxgeek
genxgeek

Reputation: 13377

How to hide spring mvc web app name in the browser url?

I have a spring mvc 3.x web app in eclipse where the resource project artifact name is "webapp". So, http://localhost:8080/webapp will load the main home page using tomcat 7 with the eclipse IDE.

However, when I release to tomcat 7.0 to some prod servers I don't want the URL to resolve to http://mywebsite.com/webapp but instead http://mywebsite.com

How can I achieve this?

Upvotes: 2

Views: 3245

Answers (1)

harrybvp
harrybvp

Reputation: 2505

You can follow either of below approaches

  1. Delete existing ROOT/ directory (in webapps) from tomcat and rename your war file to ROOT.war and then deploy it.

  2. Configure the context root in tomcat's conf/server.xml to use your war file (assuming my_war is your war name)

    < Context path="" docBase="my_war" reloadable="true">

Upvotes: 3

Related Questions