【问题标题】:How do I redirect all but a single url to https in ASP.Net?如何在 ASP.Net 中将除单个 URL 之外的所有 URL 重定向到 https?
【发布时间】:2014-03-30 04:19:40
【问题描述】:

我的 web.config 中有以下代码:

<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>

我想将除http://www.mysite.com/manual 之外的所有内容重定向到 https。

我将如何修改上述内容以允许这样做?

【问题讨论】:

    标签: asp.net web-config http-redirect


    【解决方案1】:

    在条件标签中添加以下代码应该没问题

    <add input="{REQUEST_URI}" negate="true" pattern="^/manual/*" ignoreCase="true" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      • 2020-11-27
      • 1970-01-01
      • 2016-10-17
      • 2017-01-14
      • 2016-02-25
      • 2020-08-07
      相关资源
      最近更新 更多