我想永久重定向
/?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>/?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”
最佳答案
这看起来很奇怪。以下内容对我有用:
<rule>
<condition type="query-string">page=download</condition>
<from>/</from>
<to type="permanent-redirect" last="true">/downloads</to>
</rule>
正如您所提到的,您必须有其他一些干扰规则。
关于java - Tuckey URL 重写中的转义问号(XML/Regex),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14879308/