网站继续显示IIS Windows Server页面

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

我已经在IIS服务器上配置了wordpress网站。我们有一个使用SSL的域名,我已经将我的网站从本地URL配置(使用mysql URL进行站点绑定)到实时域URL。我还将通过使用以下规则将http重定向到https到wp.config文件中:

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

借助上述重定向,我们可以正确地从http重定向到https URL。但是,当我尝试访问不带任何http或https(仅网站名称)的网站URL时,它将重定向到IIS Windows Server页面,为什么?因此,我想,当有人在地址栏中仅输入网站URL(例如google.com)而不使用http或https时,这样就不会重定向到IIS Windows Server页面。

我还需要设置其他重定向吗?或还有什么需要做的,请提出建议。

php wordpress redirect iis-8 windows-server-2012
1个回答
0
投票

浏览器将在名称前自动添加一个http://。但是,我怀疑您使用的是自动添加http://www的旧版浏览器。 ...这将失败,因为您的规则将不匹配子域,因此,您最终进入IIS默认页面。将您的重定向操作更改为此:

<conditions>
    <add input="{HTTP_HOST}" pattern="^(.*)incomegenius.net$" />
    <add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://incomegenius.net{REQUEST_URI}" appendQueryString="false" />

这将重定向到非www。 HTTPS URL,无论使用哪个子域。

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