开发兔

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

 

搜索到的教程大部分都是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的链接
http://fangzhanba.com/tech/fuwuqi/4046.html
posted on 2022-08-27 11:01  kaifatu  阅读(84)  评论(0编辑  收藏  举报