What is relative vs absolute links?

When designing a site, you will always face the question of whether you should use relative or absolute links. Later in this answer I will explain the benefits of each but first here is a definition:

Relative: Relative links usually look something like index.html or /folder/page.html. The way the page knows where to go is all relative to the page the link is placed on. A link to index.html for example, will only work if the file is found in the current folder.

Absolute: Absolute links usually look something like http://www.example.com/page.html. This is a full url and the linked to page will be found regardless of where that link is located on the site.

Which you use depends on the following:

Speed: When your browser goes to find a page with a relative url it looks within the existing site. When it uses an absolute url it leaves the site for an instant and “refinds” the page. This means when it comes to speed, relative is the way to go.

Ease of Design: When you are designing a site using notepad, the danger with relative urls is that if you move a folder, it can break your entire site. As each page depends on another, if you are not a find and replace whiz, absolute may be your best bet.

SEO: This is the one area that I would place firmly in “Theory or Assumption”. The truth is that we know broken links can hurt you so the most important is to choose a technique of linking that works best for your site. One of the better case for Absolute Links can be seen here

Posted by

Leave a Reply

You must be logged in to post a comment.