是否有可能根据最初请求的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