加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

正则表达式 – 为什么Apache删除多个斜杠?

发布时间:2020-12-14 06:30:55 所属栏目:百科 来源:网络整理
导读:这个RewriteRule RewriteRule ^ test /(.*)$test.php?url = $1 在此URL上 mysite.com/test//one///two////three/// 给我这个结果 $1 = URL = ‘一/二/ /’ 我正在使用easyphp,如果它很重要,我想知道为什么Apache在内部删除多个斜杠而不重定向到更正的URL?
这个RewriteRule

RewriteRule ^ test /(.*)$test.php?url = $1

在此URL上

mysite.com/test//one///two////three///

给我这个结果

$1 = URL = ‘一/二/ /’

我正在使用easyphp,如果它很重要,我想知道为什么Apache在内部删除多个斜杠而不重定向到更正的URL?以及如何禁用或添加重定向到此行为?

预先感谢

似乎有多个斜线违反标准.正如 this post所指出的那样,RFC 1630说:

PATH

The rest of the URI follows the colon in a format depending on the
scheme. The path is interpreted in a manner dependent on the
protocol being used. However,when it contains slashes,these
ust imply a hierarchical structure.

///并不意味着层次结构 – 你有空的文件夹名称.从那以后我猜想Apache的行为是设计的. (使用多个斜杠也不是一个好主意,因为结果将是无效的URL).

我会改用不同的角色.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读