每当有人通过HTTP协议提出请求,我将重写该URL以使其成为HTTPS.这是web.config中的代码:
<rule name="Imported Rule 1-1" enabled="true" stopProcessing="true"> <match url="^(?!https://).*" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{SERVER_PORT}" pattern="80" ignoreCase="false" /> </conditions> <action type="Rewrite" url="https://abc.com/{R:1}" /> </rule>
但是当我浏览http://我收到IIS错误
HTTP Error 500.50 – URL Rewrite Module Error. The expression
"https://abc.com/{R:1}"
cannot be expanded.
我该如何解决?我完全迷惑了
解决方法
比赛为零.
<action type="Rewrite" url="https://abc.com/{R:1}" />
不行,因为你只有一场比赛.你需要:
<action type="Rewrite" url="https://abc.com/{R:0}" />
此外,这将无法正常工作,因为您只能在站点根目录下的路径上进行匹配.
<match url="^(?!https://).*" ignoreCase="false" />
看起来你正在检查ssl.改为:
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTPS}" pattern="^OFF$" /> </conditions>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。