简体   繁体   中英

Escaping Question Mark in Tuckey Url rewriting (XML/Regex)

I want to permanent redirect

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

I tried the rules :

 <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>

But without success.

I tried this one :

 <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>

which is working for the rewrite but then I got a "too many redirect" because of other rules i guess, even though the parameter last="true" is set

That seems strange. The following worked for me:

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

You must have some other interfering rule as you also mentioned.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM