在 IIS 10 (Win Server 2019) 上将网站重定向到 www 问题

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

我在

React
上有网站,该网站在
3000
端口上运行。目前,我的网站使用
www
且不使用
www
,这会导致
SEO
引擎出现重复问题。我想让网站始终重定向到
https://www.pess.org.ua

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://localhost:3000/{R:1}" />
                </rule>
                <rule name="RedirectToWWW" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{HTTP_HOST}" pattern="^pess.org.ua$" />
                    </conditions>
                    <action type="Redirect" url="https://www.pess.org.ua/{R:1}" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>
        <httpErrors>
            <remove statusCode="502" subStatusCode="-1" />
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/errors/404.html" responseMode="ExecuteURL" />
            <error statusCode="502" prefixLanguageFilePath="" path="/errors/502.html" responseMode="ExecuteURL" />
        </httpErrors>
    </system.webServer>
</configuration>

当我输入

http://pess.org.ua
时,它会重定向到 https://www.pess.org.ua:3000/,这会将
3000
端口添加到 URL,但失败并出现以下问题:
This site can’t provide a secure connection www.pess.org.ua sent an invalid response. ERR_SSL_PROTOCOL_ERROR
。如何从 URL 中删除此端口或在没有端口的情况下重定向
3000

reactjs typescript redirect iis-10
© www.soinside.com 2019 - 2024. All rights reserved.