zoukankan      html  css  js  c++  java
  • IIS7多站点ssl配置及http自动跳转到https

    SSL证书配置参考如下:

    http转https实战教程iis7.5

    window08 IIS7安装多域名SSL证书绑定443端口

    关键是修改C:WindowsSystem32inetsrvconfigapplicationHost.config配置在443后面加上指定的域名

    http跳转https,参考如下:

    https://www.cnblogs.com/wer-ltm/p/10190535.html

    https://www.cnblogs.com/xiaohi/p/8038042.html

    关键代码:

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

    如果一个站点绑定多个域名(未必是子域名):

    a.domain.com

    b.domain.com

    c.domain.com

    我们只需要子域名a跳转,参考如下:

    IIS rewrite rule to redirect specific domain url to different url on same domain

    则配置如下:

    <rewrite>
      <rules>
        <rule name="redirect" enabled="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" />
            <add input="{HTTP_HOST}" pattern="^a.domain.com$" />
          </conditions>
          <action type="Redirect" url="https://a.domain.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>

     IIS配置不带www跳转到www,参考如下:IIS7设置将域名不带www跳转到带www上

    主要配置如下:

            <rewrite>
                <rules>
                    <rule name="www" stopProcessing="true">
                        <match url="^(.*)" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{HTTP_HOST}" pattern="^(domain.com)(:80)?" />
                        </conditions>
                        <action type="Redirect" url="http://www.domain.com/{R:1}" redirectType="Permanent" />
                    </rule>
                </rules>
            </rewrite>
  • 相关阅读:
    校验参考相关备份
    API接口设计
    redis 基础配置
    Apollo 统一配置中心
    http返回状态码记录
    ngnix实战
    OAuth2三方授权
    OAuth2授权协议记录
    KMP算法
    分治法
  • 原文地址:https://www.cnblogs.com/coce/p/11247404.html
Copyright © 2011-2022 走看看