开发者

difference between "/page" and "http://www.domain.com/page"

开发者 https://www.devze.com 2023-02-19 05:55 出处:网络
Assuming all pages uses HTTP protocol in a site. There开发者_如何转开发 is any difference in any meaning between these 2 lines?

Assuming all pages uses HTTP protocol in a site. There开发者_如何转开发 is any difference in any meaning between these 2 lines?

<a href="/page"> my page</a>

and

<a href="http://www.domain.com/page"> my page</a>

Obviously I'm saying that both urls points to the same site (the domain for "/page" is www.domain.com)

Thanks!


No. URIs specified as an absolute path are always rooted at the base of the URI space (note that some schemes do not support the concept of a "base" though).


No, not unless domain.com is your site. Omitting the domain will always have the link point to an internal document.

However,

<a href="/page"> my page </a>

and

<a href="page"> my page </a>

can be different. The one with the slash infront will try to get a document starting from the web root.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号