Http_trailing_slashes

Trailing slashes

Url尾部的/视情况可能会有不同预期:

| 位置 | 例子 | 是否相同 |

| ——- | —————————————— | ————- |
| domain后 | github.com/
github.com | 相同 |
| path后 | github.com/kivihub
github.com/kivihub/ | 不同,但可以通过重定向趋同 |

URL规范里path后的有/,资源视为一个目录,否则视为一个文件,当然你也可以按个人喜好定义。

参考

  1. Should You Have a Trailing Slash at the End of URLs?
  2. https://developers.google.com/search/blog/2010/04/to-slash-or-not-to-slash

评论