在Tuckey Url重写中转义问号(XML / Regex)

时间:2013-02-14 16:21:11

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

我想永久重定向

/?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”已设置

1 个答案:

答案 0 :(得分:1)

这看起来很奇怪。以下对我有用:

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

您还必须提到其他一些干扰规则。