iis設置http重置到https


http://www.cnblogs.com/tangge/p/4259749.html

1、購買SSL證書,參考:http://www.cnblogs.com/yipu/p/3722135.html

2、IIS7 / IIS 7.5 下綁定 HTTPS 網站(購買Wildcard SSL泛域名證書可綁定多個子域名)參考上文

3、下載安裝URL重寫模塊:Microsoft URL Rewrite Module

32位:http://download.microsoft.com/download/4/9/C/49CD28DB-4AA6-4A51-9437-AA001221F606/rewrite_x86_zh-CN.msi

64位:http://download.microsoft.com/download/4/E/7/4E7ECE9A-DF55-4F90-A354-B497072BDE0A/rewrite_x64_zh-CN.msi

4、取消勾選“SSL設置”-》“要求 SSL”

5、ASP.NET站可直接修改web.config(與“6、IIS配置圖示”效果相同),例如:見<rewrite>...</rewrite>節點

復制代碼

<?xml version="1.0" encoding="utf-8"?>
<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="Found" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

復制代碼

6、IIS配置圖示(圖形化的操作過程,與上步效果相同,適用於asp/php等站)

選擇要配置的網站,如:,找到“URL重寫”,沒有的話看上面第3步

進入“URL重寫”模塊,點擊“添加規則”

選擇“空白規則”

名稱:HTTP to HTTPS redirect

模式:(.*)

條件輸入:{HTTP}

模式:off 或 ^OFF$

 或 

重定向URL:https://{HTTP_HOST}/{R:1}

重定向類型:已找到(302) 或 參閱其它(303)

配置完成后“應用”到當前站點:

URL重寫配置結果:

至此配置完成!

參考網站:

http://www.iis-aid.com/articles/how_to_guides/redirect_http_to_https_iis_7

http://www.jppinto.com/2010/03/automatically-redirect-http-requests-to-https-on-iis7-using-url-rewrite-2-0/

http://webactivedirectory.com/iis-microsoft/redirect-http-to-https-on-microsoft-iis-7-and-7-5/

http://blog.csdn.net/xuhuojun/article/details/6137154


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM