iis url 将 http 重定向到非 www https [英] iis url redirect http to non www https
本文介绍了iis url 将 http 重定向到非 www https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要重定向自
www.domain.de 到 https://domain.de-作品
http://www.domain.de 到 https://domain.de-作品
http://domain.de 到 https://domain.de- 不起作用
rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www.(.+)$" />
</conditions>
<action type="Redirect" url="https://{C:1}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
推荐答案
我认为这对你有用,搜索模式有可选的 www 并使用反向引用 C:2 重定向,规则有一个条件只能运行反对非 https.
I think this will work for you, the search pattern has the optional www and redirects using the back reference C:2, the rule has a condition to only run against non https.
这是模式:
"^(www.)?(.*)$"
哪里:
{C:0} - www.domain.de
{C:1} - www.
{C:2} - domain.de
这是完整的规则:
<rewrite>
<rules>
<rule name="SecureRedirect" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="^(www.)?(.*)$" />
</conditions>
<action type="Redirect" url="https://{C:2}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
这篇关于iis url 将 http 重定向到非 www https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文