如何解析以`./`开头的html链接

时间:2015-06-09 22:38:59

标签: html url

./开头的锚点href应该被解析为名称为.的文件夹,还是相对于当前根目录的路径?

1 个答案:

答案 0 :(得分:1)

RFC1808说你应该忽略它们,无论它们在哪条路径上。

All occurrences of "./", where "." is a complete path segment, are removed.

If the path ends with "." as a complete path segment, that "." is removed.

这意味着./folder/file.txt之类的链接将成为folder/file.txt,这是一个相对于当前目录的路径,应该按原样处理。