使用 webconfig 文件中的重写规则将 https 重定向到 http [英] Redirect https to http using rewrite rule in webconfig file

查看:84
本文介绍了使用 webconfig 文件中的重写规则将 https 重定向到 http的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我迄今为止尝试过的.

This is what I have tried so far.

 <rule name="https main site to http" stopProcessing="true">
       <match url="^(.*)$" ignoreCase="true" />
       <conditions>
            <add input="{HTTPS}" pattern="Off" />
       </conditions>
       <action type="Redirect" url="http://{HTTP_HOST}/{REQUEST_URI}" />
 </rule>

如何将 https://www.mysite.com 重定向到 http://www.mysite.com

推荐答案

很久以前就有人问过这个问题,但看起来这里已经有人回答了:如何使用 web.config 文件强制 HTTPS.请密切注意其中一条评论,其中提到如果使用完整答案,查询字符串会附加两次.

This was asked a long time ago, but it looks like this has already been answered here: How to force HTTPS using a web.config file. Pay close attention to one of the comments that mentions that the query string is appended twice if you use the full answer.

这篇关于使用 webconfig 文件中的重写规则将 https 重定向到 http的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆