【发布时间】:2019-01-24 08:41:50
【问题描述】:
我有要求将任何 http 请求重定向到 https,即 http://test.amey.com/sitename 到 https://test.amey.com/sitename 为了实现这一点,我在 IIS url rewrite 中应用以下规则
<rule name="HTTP to HTTPS Redirect" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/sitename" />
</rule>
上述规则工作正常,它将任何 http 请求重定向到 https。
但我有另一个要求,我想将某些页面的 https 请求重定向到 http 以及它下面的任何内容,即 https://test.amey.com/sitename/reports/index - (其中报告是控制器名称和索引是操作方法) 到 > http://test.amey.com/sitename/reports/index
报告在此目录下有更多页面,所以我想应用规则,报告下的任何内容都应重定向到 http,即
https://test.amey.com/sitename/reports/sales 到 http://test.amey.com/sitename/reports/sales
https://test.amey.com/sitename/reports/weeklysale 到 http://test.amey.com/sitename/reports/weeklysale
我一直在寻找解决方案,但无法解决任何问题。任何帮助都将是很大的优势。
谢谢
【问题讨论】:
标签: http redirect iis https url-rewriting