【发布时间】:2011-09-27 06:25:30
【问题描述】:
我在我的 web.config 文件中使用以下代码在我的整个网站上强制使用 SSL;
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect HTTP to HTTPS" stopProcessing="true">
<match url="(.*)"/>
<conditions>
<add input="{HTTPS}" pattern="^OFF$"/>
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther"/>
</rule>
</rules>
</rewrite>
</system.webServer>
但我想做的是只强制 ssl 使用 ~/purchase/ 和 ~/account/ 路径及其下。匹配的网址应该是什么?
注意 正则表达式在这里也适用于我以及通配符。
【问题讨论】:
-
哦,天哪。在 stackoverflow.com 就足够了。这个话题怎么可能是off topic?如果有人投票将此作为离题问题结束,那么他/她对编程一无所知。如果您投票决定关闭,请尊重并发表评论解释原因!
标签: asp.net regex iis iis-7 https