想知道是否有人可以提供帮助。非常感谢!HTTP到HTTPS重定向只有一个URL
问题:
- blog.example.com
cool.example.com
重定向到https://www.example.com
目标:
我们正在努力只能重定向
http://example.com
http://www.example.com
到https://www.example.com
当前代码
在web.config中目前的代码是这样的。卡住<match url="(.*)">
以下是重写规则的其余部分。
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to https">
<match url="(.*)" />
<conditions>
<add input="{SERVER_PORT}" pattern="443" negate="true" />
</conditions>
<action type="Redirect" url="https://www.example.com" />
</rule>
</rules>
</rewrite>
<modules runAllManagedModulesForAllRequests="true"/>
<defaultDocument enabled="true">
<files>
<clear/>
<!--Remove this line or place below to deprecate-->
<add value="default.aspx"/>
<add value="index.html"/>
<add value="index.php"/>
<add value="default.html"/>
</files>
</defaultDocument>
我不是太熟悉的正则表达式。你的意思是这个''? –
Danger14
2012-03-01 00:00:10
你可以使用正则表达式或通配符 - 我总是使用UI来设置规则,这种方式更容易;-) – 2012-03-01 00:02:22
对不起,你会介意给我一个URL,我可以学习如何编写这个规则?什么是UI? – Danger14 2012-03-01 00:08:10