IIS Web URL 通过 http 到 https 不同端口重定向到子文件夹

问题描述

我在我的服务器中使用 IIS 7.5 作为网络服务器。 请求您支持从 HTTP 到 HTTPS 的 URL 重定向。 我的 HTTP 服务运行在 80 端口,HTTPS 运行在 4545 端口。由于端口更改出现问题。

还请帮我从根文件重定向到 4545 端口上的子文件夹。

解决方法

您可以使用此 URL 重写规则:

    <rewrite>
            <rules>
                <rule name="HTTPS Redirect" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://localhost:4545/..." appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>

此规则的URL部分需要自己修改。