是否有可能根據最初請求的URL中查詢字符串的存在使用web.config重定向?我不確定要在條件中包含哪些內容。我在與改寫工作是一個初學者/重定向規則在web.config中,並想了解更多關於語法,參數等IIS 7重寫規則 - 基於查詢字符串的存在重定向
我試圖做這樣的事情:
<rewrite>
<rules>
<rule name="Restricted Folder with Querystring" stopProcessing="true">
<match url="^test folder/(.*)" ignoreCase="false" />
<conditions>
<!--redirect to a certain page if a certain querystring is present -->
</conditions>
<action type="Redirect" redirectType="Permanent" url="/test folder/{R:1}" />
</rule>
<rule name="Restricted Folder without Querystring" stopProcessing="true">
<match url="^test folder/(.*)" ignoreCase="false" />
<conditions>
<!--redirect to another page if querystring is not present -->
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://www.whatever.com/page.asp?url={R:1}" />
</rule>
</rules>
</rewrite>
你應該改變你的代碼,按@emailstudioadam評論。 – GregoryBrad