http url 中 /root 和 /root/ 相同吗?

2015-10-22 16:22:56 +08:00
 wencan

https://www.v2ex.com/new 创作新主题
https://www.v2ex.com/new/ 404

https://golang.org/doc 会跳转到 https://golang.org/doc/

下面两个是一样的
https://github.com/wencan/docker-library
https://github.com/wencan/docker-library/

今天还发现, nginx location 执行精确匹配时,/root 和 /root/是不同的

2831 次点击
所在节点    HTTP
7 条回复
blacktulip
2015-10-22 16:31:18 +08:00
google 搜 trailing slash in url
Shieffan
2015-10-22 16:32:28 +08:00
相不相同要看你服务端怎么处理,你可以定义 /root 跟 /root/为不同的业务逻辑,你也可以让 /root 301 到 /root/,你也可以 rewrite 掉结尾的 /
wildfates
2015-10-22 16:33:17 +08:00
/root.txt

/root/.txt

这种是不是就明白了?

带 /是文件夹,不带是文件
imkodo
2015-10-22 16:46:19 +08:00
域名后面从"/"开始的字符串服务器是怎么处理的你永远都不知道
wencan
2015-10-22 17:06:07 +08:00
@wildfates 我也知道一个是文件,一个是文件夹
但这是对传统的文件服务器而言的
cevincheung
2015-10-22 17:08:03 +08:00
URL 表示一个资源。
/root 和 /root/ 代表是两个资源。
xfspace
2015-10-22 17:10:57 +08:00
url rewrite

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/230220

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX