是否可以根据最初请求的 URL 中存在的查询字符串使用 web.config 进行重定向?我不确定条件中包含什么。我是在 web.config 中使用重写/重定向规则的初学者,想了解更多关于语法、参数等的信息。
我正在尝试做这样的事情:
<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>