一个项目多个子域名的问题

rexhee 2007-08-30 06:45:30
一个J2EE项目
使用了SSH结构,服务器是 apache + tomcat
原来没有考虑到这个问题
所以访问子项目都是通过文件夹的形式访问的
如:http://www.localhost.com/shops/

文件结构如下:
根目录:
|-------/shops
|-------/WEB-INF
|-------index.jsp
|-------/images

现在我想将让
http://shops.localhost.com
访问。
我在apache 和 tomcat 中该如何设置
在域名解析中我将
http://shops.localhost.com
指向了服务器的IP地址上了
...全文
175 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
redcn2004 2008-07-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 liguohuaty 的回复:]
<script language="JavaScript">
var vdomain="1" +document.domain + "2";
if (vdomain.indexOf("shops.localhost.com ")>0)
window.location.href="http://www.localhost.com/shops/";
</script language="JavaScript">
[/Quote]
Allen_lixl 2008-07-21
  • 打赏
  • 举报
回复
<script language="JavaScript">
var vdomain="1" +document.domain + "2";
if (vdomain.indexOf("shops.localhost.com ")>0)
window.location.href="http://www.localhost.com/shops/";
</script language="JavaScript">
rexhee 2007-08-31
  • 打赏
  • 举报
回复
还有别的方法没?
forandever 2007-08-30
  • 打赏
  • 举报
回复
1 使用 apache 的url 重写
2 推荐
tomcat 换成 resin ,resin 支持基于名称和路径匹配的泛域名解析

5,657

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧