gpt4 book ai didi

redirect - IIS 7 重写规则 - 基于查询字符串的存在重定向

转载 作者:行者123 更新时间:2023-12-02 22:25:25 26 4
gpt4 key购买 nike

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

最佳答案

deeholzman,我相信对于您的条件 - 添加输入示例,您希望使用“pattern”而不是“matchType”。例如:

<add input="{QUERY_STRING}" pattern="^whateverpattern"  />

<add input="{QUERY_STRING}" pattern="^whateverpattern" negate="true" />

关于redirect - IIS 7 重写规则 - 基于查询字符串的存在重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13058473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com