use*_*612 13 iis ssl https redirect http
我最近获得了我的网站的SSL证书,并希望将所有流量重定向到HTTPS.我得到了一切,https://mydomain.com但如果有人进入http://mydomain.com/anotherpage它,则删除另一页,然后将用户带到主页.
我在我的web.config文件中的规则如下所示:
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
Run Code Online (Sandbox Code Playgroud)
我也试过https://{HTTP_HOST}{REQUEST_URI}没有任何成功.任何人都可以告诉我我需要做些什么来使网站重定向到正确的HTTPS版本的页面?我觉得它与模式有关,但我似乎无法弄清楚语法.
小智 13
我找到了一种方法,你不需要Rewrite模块.
以下在Windows 8(IIS 8.5)上为我工作:

现在,所有HTTP请求都将重定向到您的HTTPS站点,并将保留URL的其余部分.
小智 5
将其更改为:
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15352 次 |
| 最近记录: |