1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 1.33 out of 5)
Loading ... Loading ...

Welcome back! Thanks for sticking by.

Absolute vs relative URL structure: which one is better for search engines?

Now, this one is a tough question. There is numerous number of posts concerning this subject. I decided to put all that together in a single article.

Absolute and relative links

An absolute link specifies exactly the location of the file on the Internet. It hold information about the protocol used to get the document (http, ftp), the name of the server/domain that the document is located in and the full name of the document including its extension (htm, html, php, asp etc.). An absolute link looks like that:

<a href="http://www.example.com/index.html"></a>

http - the protocol

example.com - the server name

index.html - file name with extension

As you can see it is a direct link to that file. You know exactly where it is and where to look for it on the Internet.

With a relative link you simply skip the protocol and server/domain name and write directly the file name with its extension. For example:

<a href="index.html"></a>

Its just a relative path of the file location on the server. It does not include the direct location of a file on the Internet. It simply holds data about the file location within the server it locates in.

What search engines have to say

For search engines it does not matter if you use absolute or relative URL structure on your website. The search engines will automatically convert relative to absolute url’s if encountered. They simply are able to follow and index both URl structures in the same way. Clever, huh?

Furthermore using absolute or relative links will not rank your site higher in SERP’s just because you choose to use one method over another.

So why that is such a big deal?

Because search engines itself are not helping us to solve the case of absolute vs relative url’s. Here are some quotations:

We also suggest you link to other pages of your site using absolute, rather than relative, links with the version of the domain you want to be indexed under. For instance, from your home page, rather than link to products.html, link to http://www.example.com/products.html . And whenever possible, make sure that other sites are linking to you using the version of the domain name that you prefer. - Inside Google Sitemaps.

…absolute links have less potential for getting messed up [when Google indexes your page]. Even though it shouldn’t make a difference, I recommend absolute links. - GoogleGuy, an employee of Google.

How interesting. Search engines can spider both types of url’s, yet they suggest using absolute over relative links structure.

The technical issues

The answer might lay in technical obstacles why search engines don’t give the one answer to which URL’s to use: absolute or relative.

http and https of the same website have the same content, yet are seen as different pages under different URL’s. That may cause a duplicate content issues.

For example, suppose you use relative url’s on your e-commerce website and you have the same content on both versions (http and https) and you link to files that are located only on one version of your website: either http or https. By doing this you will cause a 404 File Not Found errors and confuse search engines and your users. Why? Because if you are on http version of your site and you link to content available only on https version of your site, the relative url will not work and you will get a 404 error page.

Another example:

Let’s say you click on a link to a secure, https: page but decide you want to go back to where you were. If the link on the https: page that goes back to where you were is a relative URL (doesn’t include the domain information in the link) you’ll wind up on what appears to be the same page you came from, but if you look at the URL, it will now be an https: URL.

It means that you will end up on the same page, but with different protocol (https instead of http). That may cause indexing both versions of a website by search engines and may lead to duplicate content problems.

There are some solutions to that thought. One is to 301 redirect all pages from https to http if thats possible. You should also remember to put an absolute links on ALL secured pages (eg. with https protocol) to eliminate the problem. You should also exclude the secure areas of your website from indexation through the robots.txt file or a noindex, nofollow meta tags.

Another solution may be to use the base href tag in the head section of a web page:

<base href="http://www.example.com" />

That code will instruct the search engine spiders that this is the base url for the relative type link structure. So every time you use a relative path on your website, a search engine will use the base url to fill in the whole url of the file on the server to access it.

So, using the base href tag above, you’ll need your relative links to be like this:

a href="/index.html"

If you add the “/” to the end of the domain in the base tag (http://www.sampledomain.com/), then you can link like this:

a href="contact.html"

Be consistent

Never use two types of URL’s on your website. If you decide to use relative ones, stick with them. If you prefer to use an absolute link architecture, use it through the entire website. That way you will help search engines to spider your website easier and faster.

Which one is better?

I would say that there are more advantages in using the absolute url link structure in your internal linking architecture (a great list of pros and cons of absolute vs relative url structure can be found at Search Engine Journal).

But once again i will say this: it depends.

It depends on your website current architecture. It depends on your personal preferences. It depends on what you have observed yourself about search engines and their behavior (if you have any hints or tips concerning this or other SEO subjects please contact me).

I personally prefer to use the absolute url structure. What are your preferences and opinions?

Sphere: Related Content