Absolute vs Relative Links : Technical Difference

2020-05-01 09:15发布

Which is better option or there is no difference in terms of speed or other issues like SEO, Backlinks

href="http://www.example.com/contact"

href="../../contact"

From what i observe, Absolute paths uses paths from left to right finally move to rightmost position as in http//www.example/contact

fpr relative paths: first it gets the current location, then based ../../contact or ../blog/articles move there.

Technically which is faster, as mentioned in answers speed difference is ignorable/minute. But how it works

2条回答
够拽才男人
2楼-- · 2020-05-01 09:37

Use absolute urls for linking to other web sites, and relative urls if the page your are linking to is in your website. More can be found @ http://kb.iu.edu/data/abwp.html

Absolute URL's are protocol://domain/path

Relative URL's are <a href="foobar.html">The Wonderful World of Foobar!</a>

查看更多
Viruses.
3楼-- · 2020-05-01 09:46

There is no (measurable) difference in speed or anything as regards to search engines and other software that processes HTML pages as delivered on the web.

The reason is that relative URLs are resolved to absolute URLs applying well-defined algorithms that are known to authors of relevant software. So when your page contains href="../../contact", it will be resolved using the current base URL, and the nanoseconds required for this are ignorable.

The use of relative vs. absolute URLs from the authoring point is a different issue, and well covered in the question already mentioned: Absolute vs relative URLs

查看更多
登录 后发表回答