简体   繁体   中英

URL forwarding in deploying tomcat web application

I have tried to look if this question was asked before but I couldn't find an answer. I want to deploy tomcat web application, let's call it X. Now when I type URL on the browser, say www.example.com/X, the project is deployed successfully.

But I don't want a user to go through all of that. What I want to achieve is that a user has only to type www.example.com then he will be automatically directed to www.example.com/X. Can I configure this in the server? or what is the convenient way to go with it?

This is achieved with the Server.Service.Engine.Host.Context element in conf/server.xml

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

<Context docBase="C:\\Program Files\\Apache Software Foundation\\apache-tomcat-6.0.37\\webapps\\X" path="" reloadable="true" />

Add the configuration, then restart the tomcat server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM