IIS7将https重定向到除1页之外的http

时间:2013-03-01 04:01:43

标签: iis-7

我有一条规则

<rule name="HTTPS to HTTP Redirect" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
       <add input="{HTTPS}" pattern="on" />
    </conditions>
    <action type="Redirect" url="http://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>

将所有HTTPS重定向到HTTP,但我现在需要1页为HTTPS。

由于

2 个答案:

答案 0 :(得分:0)

试试这个。我假设您的页面强制HTTPS是login.aspx。

<rewrite>
<rules>
    <rule name="Force HTTPS for 1 page " stopProcessing="true">
        <match url="(.*)/login.aspx" />
        <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}/{R:0}" redirectType="Permanent" />
    </rule>
    <rule name="Others Force HTTP" stopProcessing="true">
        <match url="((.*))" negate="true" />
        <conditions>  
            <add input="{HTTPS}" pattern="^ON$" />
        </conditions>
        <action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
    </rule>
</rules>
</rewrite>

答案 1 :(得分:0)

您好,您可以尝试下面的正则表达式:除了help.html页面之外,这将与https匹配。

^[hH][Tt]{2}[pP][Ss](?!.*help.html).*$
相关问题