问题
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