【发布时间】:2014-11-04 04:42:59
【问题描述】:
我需要将所有https请求重定向到http,例如如果有人访问https://www.example.com/another-page/到http://www.example.com/another-page/
我的 web.config 现在有以下重写规则,但它不能正常工作。它将https://www.example.com/another-page/ 重定向到https://www.example.com/,因此重定向到站点的根目录,但我希望重定向保持在同一个URL 中,并且只将https 重写为http。
<rule name="Redirect to HTTP" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{R:1}" pattern="^onepage/(.*)$" negate="true" />
<add input="{HTTPS}" pattern="^ON$" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/{R:0}" redirectType="Permanent" />
</rule>
任何有关更改上述规则以使其仅将 https 更改为 http,但保留完整 url 访问的帮助将不胜感激!
【问题讨论】:
-
<add input="{R:1}" pattern="^onepage/(.*)$" negate="true" />有什么用? -
非常相关,虽然这个问题在技术上不是一个骗局:stackoverflow.com/questions/9823010/…
标签: iis url-rewriting web-config