【问题标题】:How does IIS URL Rewrite handle # anchor tagsIIS URL Rewrite 如何处理 # 锚标记
【发布时间】:2012-03-14 10:19:11
【问题描述】:

我正在努力寻找有关如何最好地处理带有锚标记的 URL 的任何信息,例如 www.example.com/index.html#foo 中的#foo

我们目前的情况是尝试对带有锚标记的 URL 使用 Rewrite 映射,但它被另一个 Rewrite 映射胜过。

例如

 <add key="index.html#foo" value="bar1.html" />
 <add key="index.html" value="bar2.html" />

 <!-- A request to index.html#foo is being redirected to bar2.html, 
      not bar1.html as expected -->

URL Rewrite 是否在 URL 中包含此内容?或者可以通过变量之一获得?有这方面的文档吗?

(我也试过搜索“片段标识符”、“#”、“hash”、“hash tag”)

【问题讨论】:

  • 我现在遇到了类似的问题,我想知道发生了什么,但到目前为止我发现的最多的是 IE 认为发送时的 # 是一个脚本标签所以它在发送中被消除。或类似的东西。

标签: iis anchor hashtag url-rewrite-module


【解决方案1】:

根据 HTTP 规范,#(片段)之后的 URL 部分永远不会传递给服务器,因此,URL 重写不会看到它。

来源: Does IIS throw away the URL fragment on custom error pages?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-10
    • 2016-02-25
    • 2011-07-31
    • 1970-01-01
    • 2020-02-22
    • 1970-01-01
    • 2013-12-10
    相关资源
    最近更新 更多