【问题标题】:tomcat urlrewritefilter baseurltomcat urlrewritefilter baseurl
【发布时间】:2014-04-01 22:51:28
【问题描述】:

伙计们

如何将http://airizu.com/ 重定向到http://www.airizu.com/

我们使用Tomcat作为JSP服务器,一开始我们使用http://airizu.com作为url的根, 和谷歌索引我的网站。

但是现在,我们想使用一个 url root,你知道http://www.airizu.com/

所以我必须使用一些urlrewrite来重定向url,http代码必须是301。

我研究了很多文章,找到了一个模块: http://code.google.com/p/urlrewritefilter

如何使用此模块进行 url 重定向?

【问题讨论】:

    标签: tomcat url-rewriting url-routing


    【解决方案1】:

    只需在此处安装以下说明:http://code.google.com/p/urlrewritefilter

    然后添加一个类似于以下内容的规则:

    <rule>
        <name>Domain Name Check</name>
        <condition name="host" operator="notequal">www.example.com</condition>
        <from>^(.*)$</from>
        <to type="redirect">http://www.example.com/$1</to>
    </rule>
    

    这会检查用户是否使用正确的域名访问您的网站。即,用户 gong 到 example.com/blah 将被重定向到 www.example.com/blah

    【讨论】:

      猜你喜欢
      • 2021-01-29
      • 1970-01-01
      • 2016-01-12
      • 2011-12-12
      • 2012-03-18
      • 1970-01-01
      • 1970-01-01
      • 2011-03-24
      • 1970-01-01
      相关资源
      最近更新 更多