【发布时间】:2019-09-03 02:29:36
【问题描述】:
每当任何用户使用 http 打开我的网站时,我都必须将我的网站从 http 重定向到 https。
例如:-
http:\\abc.mywebsite.com 应该转到 https:\\abc.mywebsite.com
请注意,在上面的 URL 中,它不是 www.mywebsite.com,而是自定义 URL,如 abc.mywebsite.com。
我已经尝试过URL Rewrite 工具并按照here 提到的所有步骤进行操作。但是,我无法让 URL 重写正常工作以进行重定向。
这是 IIS 中的 URL 重定向规则:-
这是使用 URL 重写添加规则后我的 web.config 的样子。
<configuration>
.....
.....
.....
<system.webServer>
.....
.....
.....
<rewrite>
<rules>
<rule name="Http to Https" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
.....
.....
.....
</configuration>
我还取消选中 SSL 设置下的需要 SSL 复选框。
但是,在完成所有这些操作之后,我的网站仍然没有重定向到 https。只是给出错误“...无法访问此页面”。
如果我在这里遗漏了什么,请提出建议。
【问题讨论】:
标签: asp.net ssl https url-rewriting acumatica