我有這些網址:
https://www.example.com/amp/articles/10/title
https://www.example.com/amp/videos/11/title
我只需要將特定的 id 重定向到非 amp,如下所示:
https://www.example.com/articles/10/title
https://www.example.com/videos/11/title
這是我嘗試過的,但沒有 URL 重定向,沒有任何反應:
<rule name="redirect_to_non_amp_for_specific_ids" stopProcessing="true">
<match url="^amp/(articles|videos)/(10|11)/([^/] )/?$"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}/{R:2}/{R:3}"/>
</rule>
注意我需要避免多個 url-rewrite 規則。
uj5u.com熱心網友回復:
我的規則是正確的。我想我必須把它放在其他文章規則之前,為了優先級,規則才能生效。
來自 microsoft:規則按照指定的順序進行評估。
參考:https ://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/475740.html
