MC9*_*000 5 asp.net https web-config url-rewriting iis-8.5
在这里发疯。我有一个规则,将所有页面从 重定向HTTP到HTTPS,这在 IIS 8.5中运行良好,IIS8但我收到500 内部服务器错误。 我想我缺少一些配置,但是在搜索了几个小时并尝试system.WebServer了web.config文件中重写规则的各种不同更改后,我不知所措。这是代码(大约 5 个变体之一 - 没有一个有效)
<rewrite>
<rules>
<rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{SERVER_PORT_SECURE}" pattern="^0$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
如果没有简单地将其写入MasterPage(我可以做到,但是在升级之前这该死的东西一直运行良好),我是否遗漏了什么?也许是配置?
另一个有效的版本(在 IIS8.5 托管的另一个站点上)
<rewrite>
<rules>
<rule name="httpsredirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16871 次 |
| 最近记录: |