in meta tag, url with slash vs url without slash [duplicate]

这一生的挚爱 提交于 2019-12-13 08:30:43

问题


What is the difference between:

<meta http-equiv="refresh" content="0; url=/file.html" />

and

<meta http-equiv="refresh" content="0; url=file.html" />

I am calling this from domain.com/folder/index.html The first one would redirect to the domain.com/file.html and the other one to domain.com/folder/file.html. Why?


回答1:


When you use "/" as the first character of the route you mean that the route starts from the root (domain.com/). If you don't use it, the route starts from the current location (domain.com/folder/).




回答2:


Using / indicates that the path begins in the root folder. This is called an absolute path.

If you avoid the slash you are using a relative path, so the path begins in the current folder.



来源:https://stackoverflow.com/questions/29645711/in-meta-tag-url-with-slash-vs-url-without-slash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!