【问题标题】:http to https redirect url using web.config but getting HTTP Error 500.19 - Internal Server Errorhttp 到 https 重定向 url 使用 web.config 但收到 HTTP 错误 500.19 - 内部服务器错误
【发布时间】:2018-01-18 05:27:34
【问题描述】:

我尝试使用 web.config 将 http 重定向到 https url,并在 web.config 中更改如下代码。但它收到“HTTP 错误 500.19 - 内部服务器错误”的错误 请求的页面无法访问,因为该页面的相关配置数据无效。" 但是,如果我在 web.config 中删除此代码,它的工作正常。所以你能帮我做些什么改变它或它有什么问题吗?

<rewrite>
          <rules>
            <rule name="HTTP to HTTPS redirect" stopProcessing="true">
              <match url="(.*)" />
              <conditions>
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
              </conditions>
              <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}"/>
            </rule>
          </rules>
        </rewrite>

【问题讨论】:

    标签: asp.net-mvc


    【解决方案1】:

    我想如果你想向 HTTPS 发出请求。 您应该按照以下步骤操作,

    • 应安装网站的 SSL 证书。
    • 正确安装和配置站点以使用 SSL(站点设置和 IIS 中的绑定已配置)。
    • URL 重写已安装在服务器上。

    还有一件事,你写的 url 重写的代码是正确的。

    【讨论】:

    猜你喜欢
    • 2021-12-25
    • 2012-06-15
    • 2012-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-12
    • 2015-09-05
    相关资源
    最近更新 更多