【问题标题】:Single URL Rewrite rule to remove shebang and force HTTPS in IIS单个 URL 重写规则以删除 shebang 并在 IIS 中强制使用 HTTPS
【发布时间】:2018-09-14 04:28:33
【问题描述】:

我有一个这样的网址: demo.url.com/folder/folder2/#!/param1/param2

我正在尝试强制使用已成功完成的 HTTPS,但是当我尝试使用正则表达式规则来删除 #! 时,重定向时出现错误。

这是我目前拥有的:

    <match url=".*" />
<conditions logicalGrouping="MatchAny">
                    <add input="{HTTPS}" pattern="off" />
                    <add input="{REQUEST_URI}" pattern="[A-Z]" ignoreCase="false" />
                    <add input="{QUERY_STRING}" pattern=".+\#!.*" negate="true" />
 </conditions>
 <action type="Redirect" url="https://demo.url.com/{URL}" />

【问题讨论】:

    标签: regex iis url-rewriting


    【解决方案1】:

    无法根据哈希字符串进行重定向。浏览器不会将哈希后的部分传输到服务器。

    它被称为Fragment identifier,只是客户端。这意味着您将无法在服务器端看到这部分

    【讨论】:

    • 你完全正确!回到绘图板。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    • 2015-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多