任何时候你都可以开始做自己想做的事

搜索|
IIS站点强制https的方法
发布时间:2025-02-23 02:32:02

在web.config文件中添加:

<system.webServer>

    <rewrite>

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

    </rewrite>

</system.webServer>