【发布时间】:2019-12-28 08:41:36
【问题描述】:
我正在开发一个需要将 URL 从 http 重定向到 https 的网站。我的 URL 看起来像:(我每次都使用随机令牌 ID 生成此 URL)
http://testsite.local/login.aspx/activate?token=(random生成的令牌id)
我想把这个网址重定向到
https://testsite.local/login.aspx/activate?token=(random生成的令牌id)
下面是 IIS 中的 URL 重写设置:
Web.config 文件:
<rewrite>
<rules>
<rule name="http redirect">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Rewrite" url="https://{HTTP_HOST}{REQUEST_URI}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
当我输入 URL 时,我会看到 Http404 错误。在这里提一下 - 我检查了 IIS 中的“需要 SSL”条件。我知道匹配模式看起来错误,但不确定修复。有什么帮助吗?
【问题讨论】:
标签: asp.net http iis https iis-7