我在 eclipse 中创建了我的网页作为 Dynamic Web Project
并将 WebContent 文件夹
上传到 server
(WebContent
包含 index.html js、imgs 和 css
)。当我调用 myPage.com
时,它仅适用于 url myPage.com/WebContent
。之后,我将 文件夹 WebContent
目录的内容上传到 服务器根目录
。现在,当我调用 myPage.com
时,它显示空白页面。 mypage.com/index.html
也显示空白页面。
如何上传WebContent
,让index.html
不使用url
中的WebContent
显示?
最佳答案
这可以通过以下方式实现:
- 使用 URLRewrite。这个东西根据您配置的模式更改 URL。更多阅读:http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html
在根文件夹中使用重定向 - 如果有人请求该文件夹,它会自动将您转到另一个文件夹。这可以通过放置
index.html
来完成。在包含以下内容的根文件夹中:<meta http-equiv="refresh" content="0; url=http://mypage.com/WebContent" />
;使用 Virtual Host - Tomcat 6 的说明。
关于apache - myPage.com 而不是 mypage.com/WebContent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23591167/