简体   繁体   English

部署tomcat Web应用程序中的URL转发

[英]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. 我想部署tomcat Web应用程序,我们称之为X。现在,当我在浏览器中键入URL,例如www.example.com/X时,项目已成功部署。

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. 我要实现的是,用户只需键入www.example.com,然后他将被自动定向到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 这是通过conf / server.xml中的Server.Service.Engine.Host.Context元素实现的。

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html 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. 添加配置,然后重新启动tomcat服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jersey Web应用程序未部署在tomcat上 - Jersey web application not deploying on tomcat 将Web应用程序部署到URL的过程 - The process of deploying a web application to URL 在Debian上运行的Tomcat上部署Hibernate Web应用程序 - Deploying Hibernate Web Application on Tomcat running on Debian 在 Azure Tomcat 上部署 Java Web 应用程序和 Web 服务的区别 - Difference in deploying Java web application and web service on Azure Tomcat 在Tomcat Server 7.0.39上部署后,Web应用程序无法正常工作 - Web Application not working after deploying on Tomcat Server 7.0.39 错误启动子部署 spring 引导 web 应用程序到 Tomcat 9 - Error starting child deploying spring boot web application to Tomcat 9 将具有自定义领域的Web应用程序部署到Tomcat 6之后的HTTP状态404 - HTTP Status 404 after deploying a web application with a custom realm to Tomcat 6 Tomcat 9.0:安装后部署 Web 应用程序时出错 - Tomcat 9.0: Error deploying web application after install 在OpenShift Tomcat上部署后无法运行Spring MVC Web应用程序? - Not able to run Spring MVC Web application after deploying on OpenShift Tomcat? 在Ubuntu的Amazon EC2的Tomcat 7中部署Web应用程序 - Deploying web application in Tomcat 7 on Amazon EC2 on Ubuntu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM