IIS8.5中的强制https直接修改web.config文件和顶级域名跳转www和过滤子目录不强制跳转


亲测可用

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>

<rule name="301Redirect" stopProcessing="true">

<match url="(.*)" />

<conditions logicalGrouping="MatchAny">

<add input="{HTTP_HOST}" pattern="^seo-6.com$" />

</conditions>

<action type="Redirect" url="http://www.seo-6.com/{R:0}" redirectType="Permanent" />

</rule>

                <rule name="http redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                        <add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
                </rule>
//这个是xiaomingmm目录不强制HTTPS

<rule name="HttpToHttps" stopProcessing="true">
<match url="^((?!xiaoxingmm).)*$" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:0}" />
</rule>//到这结束

            </rules>
        </rewrite>
    </system.webServer>
</configuration>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM