IIS7:HTTP->HTTPS 干净利落 [英] IIS7: HTTP->HTTPS Cleanly

查看:29
本文介绍了IIS7:HTTP->HTTPS 干净利落的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种干净的方法可以将所有尝试转到 HTTP://版本的网站重定向到其等效的 HTTPS://版本?

解决方案

我认为最干净的方法是 此处在 IIS-aid.com 上.它只是 web.config,因此如果您更改服务器,您不必记住使用 403.4 自定义错误页面或其他特殊权限所经历的所有步骤,它就可以工作.

<预><代码><配置><system.webServer><重写><规则><规则名称="HTTP 到 HTTPS 重定向" stopProcessing="true"><match url="(.*)"/><条件><add input="{HTTPS}" pattern="off" ignoreCase="true"/></条件><action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}"/></规则></规则></rewrite></system.webServer></配置>

Is there a clean way to redirect all attempts to going to an HTTP:// version of a site to its HTTPS:// equivalent?

解决方案

I think the cleanest way is as described here on IIS-aid.com. It's web.config only and so if you change server you don't have to remember all the steps you went through with the 403.4 custom error page or other special permissions, it just works.

<configuration>
  <system.webServer>
    <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="Permanent" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

这篇关于IIS7:HTTP->HTTPS 干净利落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆