我已经申请了一个二级域名,如news.aorta-show.com,申请时是要求域名服务商将这个二级域名指向到http://www.aorta-show.com/news/index.html的。这个index.html是用urlrewrite来重写过的。
但有人说,自己也曾上网搜过,说在配置好后还要在tomcat里配置一下这个二级域名的,所以按网上的方法我在server.xml里加入以下的代码:
<Host name="news.aorta-show.com" debug="0" appBase="/home/tomcat/webapps/ROOT/WEB-INF/jsp/news"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>news.aorta-show.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<Context path="" docBase="/home/tomcat/webapps/ROOT/WEB-INF/jsp/news" reloadable="true" caseSensitive="false" debug="0"></Context>
</Host>
不知道是否正确?如,我在访问这个url: http://www.aorta-show.com/news/2/21/index.html里可以打开一个页面,正常访问的。但我加了以上那段代码后,想直接通过二级域名来访问,如 http://news.aorta-show.com/news/2/21/index.html来访问时就报 您指定的网页无法访问! 这个错,请问是那里出错了呢?
URL重写的规则 <rule>
<from>/news/([0-9]+)/([0-9]+)/index.html</from>
<to>/news/index.do?method=newsList&type=$1&coteid=$2&pd=$1</to>
</rule>
期待你的回答。谢谢!
但有人说,自己也曾上网搜过,说在配置好后还要在tomcat里配置一下这个二级域名的,所以按网上的方法我在server.xml里加入以下的代码:
<Host name="news.aorta-show.com" debug="0" appBase="/home/tomcat/webapps/ROOT/WEB-INF/jsp/news"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>news.aorta-show.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<Context path="" docBase="/home/tomcat/webapps/ROOT/WEB-INF/jsp/news" reloadable="true" caseSensitive="false" debug="0"></Context>
</Host>
不知道是否正确?如,我在访问这个url: http://www.aorta-show.com/news/2/21/index.html里可以打开一个页面,正常访问的。但我加了以上那段代码后,想直接通过二级域名来访问,如 http://news.aorta-show.com/news/2/21/index.html来访问时就报 您指定的网页无法访问! 这个错,请问是那里出错了呢?
URL重写的规则 <rule>
<from>/news/([0-9]+)/([0-9]+)/index.html</from>
<to>/news/index.do?method=newsList&type=$1&coteid=$2&pd=$1</to>
</rule>
期待你的回答。谢谢!
在Tomcat中设置Host是这样一种情况:news.x.com解析到你主机的IP地址时候,这时候大致可以理解成有人通过域名解析到你的IP地址,从而访问到你的网站内容了,你需要在Tomcat中设置,告诉她这个域名访问哪个目录。
配置<welcome-list>/news/index.html</welcome-list>
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>news.aorta-show.com </Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
</Host>如此测试一下看看?