我想将特定的URL永久重定向到其他域。
<rule name="URL Test" enabled="true" stopProcessing="true">
<match url="^en/career/jobs$" />
<conditions logicalGrouping="MatchAny">
</conditions>
<action type="Redirect" url="https://www.example.com/newjobs" appendQueryString="false" redirectType="Permanent" />
</rule>
它在我使用时起作用https://source.com/en/career/jobs但是当我在最后加一个斜线(https://source.com/en/career/jobs/),它不起作用。
如何在匹配url中接受这两种变体?
您只需要更改参数以匹配en/career/jobs/
和en/career/jobs
。您可以使用以下规则作为参考:
<rule name="URL Test" enabled="true" stopProcessing="true">
<match url="^en/career/jobs(.*)$" />
<action type="Redirect" url="https://www.example.com/newjobs" appendQueryString="false" redirectType="Permanent" />
</rule>