详情页

IIS7配置web.config,https重定向到http

时间:2024年03月01日

编辑:佚名

搜索到的教程大部分都是http重定向到https的,但是有些网站不需要 https的时候,就需要把https重定向回http。
.htaccess方式
RewriteCond %{SERVER_PORT} !^80$
RewriteCond %{HTTP_USER_AGENT} !MSIE/[1-8]\. [NC]
RewriteCond %{HTTP_HOST} xxx.com
RewriteRule ^.*$ http://xxx.com%{REQUEST_URI} [L,R=301]
IIS web.config方式
<rewrite>
            <rules>
                <rule name="https to http" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^ON$" />
                    </conditions>
            <action type="Redirect" url="http://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
                </rule>
            </rules>
</rewrite>
IIS7配置web.config,http重定向到https的链接。
相关文章
猜你需要