宝塔IIS8.5配置web.config实现http和https不带www跳转到带www的https

92建站   模板百科   2019-10-06   收藏本文

宝塔IIS8 5配置web config实现http和https不带www跳转到带www的https 为了保证域名统一,将访问 http: 92jzh com、http: www 92jzh com、https: 92jzh com 的域名都跳转到https: www 92jzh com,IIS 可以进行如下配置 (需要安装 IIS UrlRewrite 模块,代码注释是为了方便理解,部署到线上请删除中文注释):

小编亲测可用!!!

为了保证域名统一,将访问 http://92jzh.com、http://www.92jzh.com、https://92jzh.com 的域名都跳转到https://www.92jzh.com,IIS 可以进行如下配置:

[需要安装 IIS UrlRewrite 模块代码注释是为了方便理解,部署到线上请删除中文注释]

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
                <rule name="HTTP to HTTPS redirect" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
                </rule>
                <rule name="不带www转向www域名规则" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_HOST}" pattern="^fnyy.net$" ignoreCase="false" />
                    </conditions>
                    <action type="Redirect" url="https://www.fnyy.net{R:1}" redirectType="Found" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

上面就是不带www跳转带www和http跳转https的所有内容,你学会了么。

旺铺招租1 旺铺招租2 旺铺招租3 旺铺招租4 旺铺招租5 旺铺招租6
展开