【问题标题】:Escaping Question Mark in Tuckey Url rewriting (XML/Regex)在 Tuckey Url 重写中转义问号 (XML/Regex)
【发布时间】:2013-01-30 12:27:59
【问题描述】:

我想永久重定向

/?industry_id=3 to /industry/3/athletics

我尝试了规则:

 <rule>
    <from>/?industry_id=3$</from>
    <to type="permanent-redirect" last="true">/industry/3/athletics</to>
 </rule>

 <rule>
    <from>/&#63;industry_id=3$</from>
    <to type="permanent-redirect" last="true">/industry/3/athletics</to>
 </rule>


 <rule>
    <from>/\\?industry_id=3$</from>
    <to type="permanent-redirect" last="true">/industry/3/athletics</to>
 </rule>

 <rule>
    <from>/\?industry_id=3$</from>
    <to type="permanent-redirect" last="true">/industry/3/athletics</to>
 </rule>

但没有成功。

我试过这个:

 <rule match-type="regex">
    <note>Request page is deprecated</note>
    <condition type="query-string">industry_id=3</condition>
    <from>/</from>
    <to type="permanent-redirect" last="true">/industry/3/athletics</to>
 </rule>

这适用于重写,但由于我猜的其他规则,我得到了“重定向太多”,即使设置了参数 last="true"

【问题讨论】:

    标签: java regex url-rewriting tuckey-urlrewrite-filter


    【解决方案1】:

    这似乎很奇怪。以下对我有用:

    <rule>
      <condition type="query-string">page=download</condition>
      <from>/</from>
      <to type="permanent-redirect" last="true">/downloads</to>
    </rule>
    

    正如你提到的,你必须有其他一些干扰规则。

    【讨论】:

    • 是的,我认为可能是这种情况,感谢您的建议 BoneGoat,看起来很奇怪的是 last 等于 true,所以它不应该在逻辑上没有其他规则的情况下干扰
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-05
    • 1970-01-01
    相关资源
    最近更新 更多