如何配置 IIS,以便所有浏览器都可以显示具有固定 URL 和特定端口的站点(自动将 http 转换为 https 而不是)?

问题描述 投票:0回答:1

我在家具上刻有我们 http 网站 URL (http://asdfsite.com:800) 的二维码。 简而言之,我无法修改我的网址。 它一直运行良好,直到浏览器开始自动将 http 转换为 https。因此访问者无法查看我的网站。 为了避免这种情况,我将其更改为 https (https://asdfsite.com:800)。对于将 http 转换为 https 的浏览器,问题已解决,但其他未转换的浏览器无法查看我的网站。

如何才能使将 http 转换为 https 和未将 http 转换为 https 的浏览器都能正确显示我的网站?请考虑我有一个带有特定端口的固定 URL。

redirect iis-10
1个回答
0
投票

如果要使用 Windows IIS 10 将 HTTP 重定向到 HTTPS,则需要下载并安装 IIS URL 重写模块,然后创建以下重定向规则。

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="HTTPS Redirect" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <!-- Redirect to HTTPS with the same host and port -->
                    <action type="Redirect" url="https://{HTTP_HOST}:{SERVER_PORT}{REQUEST_URI}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

参考链接:https://www.ssl.com/how-to/redirect-http-to-https-with-windows-iis-10/

© www.soinside.com 2019 - 2024. All rights reserved.