日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

IIS中設(shè)置HTTP訪問(wèn)重定向到HTTPS_win服務(wù)器

作者:Q.E.D. ? 更新時(shí)間: 2022-06-27 編程語(yǔ)言

不啰嗦,我們直接開(kāi)始!

1、購(gòu)買SSL證書(shū)(我用的阿里云的免費(fèi)證書(shū)),然后IIS設(shè)置好SSL。

2、如果IIS沒(méi)有URL重寫(xiě)模塊,則需要下載安裝URL重寫(xiě)模塊:Microsoft URL Rewrite Module

3、取消勾選“SSL設(shè)置”-》“要求 SSL”

?

4、URL重寫(xiě)規(guī)則:ASP.NET站可直接修改web.config,和界面操作結(jié)果一致,例如:

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

5、URL重寫(xiě)規(guī)則:圖形化配置 找到“URL重寫(xiě)”

添加規(guī)則

添加入站空白規(guī)則

規(guī)則詳情

主要參數(shù)

名稱:HTTP to HTTPS redirect

模式:(.*)

條件輸入:{HTTPS}

模式:off 或 ^OFF$

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

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

配置完成后“應(yīng)用”到當(dāng)前站點(diǎn)

URL重寫(xiě)配置結(jié)果?

驗(yàn)證

通過(guò)http訪問(wèn)站點(diǎn),若自動(dòng)重定向至https則配置成功!

參考文章:

IIS重寫(xiě)HTTP重定向到HTTPS操作方法

原文鏈接:https://blog.csdn.net/qq_34272760/article/details/120195941

欄目分類
最近更新