在元标记中,url 有斜杠 vs url 没有斜杠
in meta tag, url with slash vs url without slash
有什么区别:
<meta http-equiv="refresh" content="0; url=/file.html" />
和
<meta http-equiv="refresh" content="0; url=file.html" />
我是从域调用的。com/folder/index.html 第一个将重定向到域。com/file.html 另一个重定向到域。 com/folder/file.html。为什么?
当您使用“/”作为路由的第一个字符时,表示该路由从根 (domain.com/) 开始。如果不使用,则路由从当前位置(domain.com/folder/)开始。
使用/
表示路径从根文件夹开始。这称为 绝对路径。
如果您避免使用斜杠,则表示您使用的是 相对路径 ,因此该路径从当前文件夹开始。
有什么区别:
<meta http-equiv="refresh" content="0; url=/file.html" />
和
<meta http-equiv="refresh" content="0; url=file.html" />
我是从域调用的。com/folder/index.html 第一个将重定向到域。com/file.html 另一个重定向到域。 com/folder/file.html。为什么?
当您使用“/”作为路由的第一个字符时,表示该路由从根 (domain.com/) 开始。如果不使用,则路由从当前位置(domain.com/folder/)开始。
使用/
表示路径从根文件夹开始。这称为 绝对路径。
如果您避免使用斜杠,则表示您使用的是 相对路径 ,因此该路径从当前文件夹开始。