IIS重写规则 - 重定向特定的HTTP页面

时间:2018-05-23 14:31:23

标签: windows redirect iis rules

这是我的规则:

<rule name="RedirectHttps04" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="^some-url-here$" />
<add input="{HTTPS}" pattern="^off$" />
</conditions>
<action type="Redirect" url="https://www.example.com/some-url-here" />
</rule>

根据上述规则,我希望将特定网址重定向到https,并保留所有其他网址。

所以当用户去:

www.example.com/some-url-here
http://example.com/some-url-here
http://www.example.com/some-url-here

我希望将它们重定向到: https://www.example.com/some-url-here

但是,经过这里提供的许多版本和选项之后 - 没有它们工作,在阅读了多篇文章之后我不明白为什么上面的规则不起作用(不重定向)。 我正在使用IIS 8.5.96

更多信息: {HTTPS}参数似乎始终“关闭” {HTTP}对于http为“”,对于https为“off”,但即使如此规则也不起作用

我已设置重定向到test.html?p = {CACHE_URL}并且两者似乎都将我带到test.html?p = http://example.com

我唯一能运作的是一条规则,如果没有附加参数,最后会附加参数,这是一个非常难看的黑客,但确保用户最终使用https:/

0 个答案:

没有答案
相关问题