【问题标题】:mod_rewrite not working with escaped slashesmod_rewrite 不适用于转义斜杠
【发布时间】:2014-10-03 20:11:16
【问题描述】:

mod_rewrite ReWriteRule 在正确解释包含转义正斜杠的 URL 时似乎有一个奇怪的问题。

RewriteRule article/([^/]*)/? articles/article.php?id=$1

http://www.domain.com/article/1303960/test/.html - 这可以正常工作并正确重定向

http://www.domain.com/article/1303960/test%2F.html - 这会被 mod_rewrite 忽略并给出 404。

我尝试将 [NE] 添加到 ReWriteRule 无济于事。有人有建议吗?

【问题讨论】:

    标签: apache url mod-rewrite url-rewriting


    【解决方案1】:

    这是预期的 Apache httpd 行为。

    在 Apache httpd 2.0.46 或更高版本中,您可以使用 AllowEncodedSlashes 指令(在服务器或虚拟主机配置中)允许在 URL 的路径信息部分使用 %2F。

    【讨论】:

      猜你喜欢
      • 2013-01-22
      • 2015-03-19
      • 2010-09-14
      • 2011-04-05
      • 1970-01-01
      • 2018-07-21
      • 2012-04-27
      • 2019-06-05
      • 2015-09-20
      相关资源
      最近更新 更多