Why relative vs absolute URLs matter to your search engine ranking

All articles | Content
Published Dec 12, 2017 | Written by Keith Errington

You may have come across the two ways of pointing to a web page when designing your website or blog for your inbound marketing strategy, but what are the differences, and why should you care?

Well basically, the main reason you should care is because getting it wrong may well affect your search engine ranking and therefore your customer’s ability to find you – which is pretty important.

What is a URL?

Let’s start at the beginning; URL stands for Uniform Resource Locater and it’s a way of pointing to a file on a computer network, and the way to handle that file. A URL can be used as a reference for web pages (http), file transfer (ftp) email (mailto) and many others.

In your browser you will see the URL in the address bar. The address of the blog on our web site for example is:http://www.equinetmedia.com/blog

This breaks down to a protocol – a way of handling the file: http, a hostname: www.equinetmedia.com and a file name: blog.

This is a basic URL. There are additional components that can be added, but this is the basis for all web addresses.

Because modern browser software makes certain assumptions about URLs, you don’t have to include the protocol or the file extension; .htm or .html for basic web pages; so you can type a URL that looks like this: equinetmedia.com into the browser address bar rather than the more pedantic, full address: http://www.equinetmedia/index.html and still reach the same page.

http vs https

There are numerous benefits to https – the secure version of the http protocol - so many in fact, that it is now considered essential for new websites. The biggest benefits are:

  • Security, for example, https prevents man-in-the-middle attacks
  • Privacy, for example, no online eavesdropping on users by third parties
  • Speed
  • Security, which allows processing of sensitive information such as payment processing;
  • Keeps referral data in analytics
  • Potentially improves rankings in Google Search Results
  • http websites show as insecure in browsers, whereas https shows as secure

Absolute and relative URLs

An absolute URL is a full address from the very ‘top’ of the website including every step you need to take to get to the page – ie: http://www.equinetmedia.com/blog/twenty-quick-b2b-content-wins

If an absolute URL was a street address, you could think of Equinet’s street address like this: United Kingdom/MK40 3JY/Bedford/1 Goldington Road/Equinet. And following that address would lead you to Equinet.

A relative URL on the other hand, is an address that is relative to where you are. So, taking our street address, if you were already in Goldington Road, and someone asked you where Equinet was, you would say they are at "number 1," ie: 1 Goldington Road/Equinet -which would also lead to Equinet.

So an absolute URL would be:http://www.equinetmedia.com/blog/twenty-quick-b2b-content-wins and the relative URL would be: /twenty-quick-b2b-content-wins

Why would you use a relative URL?

When creating websites, developers often have to move directories containing lots of pages around. If the pages are linked by absolute URLs then all these would have to change every time a directory name was changed.

Sites are often developed on host servers with different domain names to the final site, so again, absolute URLs would need changing once the site was published. Linking files with relative URLs meant that this is not an issue.

On a technical note, relative URLs load very slighter faster than absolute URLs (although compared with the other elements on a typical web page, it is a tiny factor.)

Did you know you have four websites?

You may not know it, but typically you potentially have four websites as search engines see them:

http://www.mywebsite.com

https://www.mywebsite.com

http://mywebsite.com

https://mywebsite.com

In an ideal world you want to choose which of these is the “real” site and resolve the other addresses to point to that one – this can be done by your web developers on the server side.

If you have the choice, then https://mywebsite.com is best as there is some evidence to suggest that Google prefers the secure protocol https over http, and the non-www URL is four characters shorter.

If you don’t do this, then any pages on your site will have four potential addresses, so any SEO benefit you get from them could be divided by four – instead of one popular page in Google’s eyes, you will have four less well-visited pages, diluting your SEO efforts.

Why would you use an absolute URL?

The problem becomes worse if you use relative links, as Google might not be able to work out which domain out of the four they are a part of. And if you have multiple levels of directories on your site, then you could have several different relative URLs all pointing to the same page.

In addition, there is only a certain amount of time and effort Google will expend crawling your site for links – this is known as a crawl budget:

“When we talk about crawl budget, basically what that is, is every time Google crawls your website, there is a finite number of URLs that they will crawl and then they decide, "Okay, I'm done."

That's based on a few different things. Your site authority is one of them. Your actual PageRank, not toolbar PageRank, but how good Google actually thinks your website is, is a big part of that. But also how complex your site is, how often it's updated, things like that are also going to contribute to how often and how deep Google is going to crawl your site.”

Ruth Burr Reedy, UpBuild

For Google, the time and bandwidth they spend crawling web sites has a definite cost implication, so they will want to crawl a site as efficiently as possible.

If your site is not search engine friendly, they will spend less time crawling the site and do it less often. So having four different versions of the website, or multiple relative links will impact on how deep, and how often search engines crawl your site – therefore having an impact on your SEO.

Use Absolute URLs

If you are just starting out, then make it a policy to use absolute URLs throughout your site, resolve the four potential domain addresses down to one and use https on your site.

If you have an existing site with relative URLs, then aim to change those for absolute URLs throughout the site as soon as possible and change to https if you haven’t already. (Be aware that changing an existing site is not straightforward though.)

Use Canonical tags

I gave a simple example earlier of four different web site addresses, but actually the problem is much bigger than that. Let’s look at the example of a home page – the same page could potentially be reached by search engine crawlers in several different ways:

http://www.mywebsite.com

https://www.mywebsite.com

http://mywebsite.com

http://mywebsite.com/index.php

http://mywebsite.com/index.php?refer=twitter

And this is just a small range of potential variations. Code driven websites and content management systems can make this even worse; generating a wide range of different URLs for pages.

Wouldn’t it be good if there was a way that we could tell search engines which page is the definitive page, the only page that they should link to and index?

Well, that’s what the canonical tag is for. It is placed in the HTML header of a page and looks like this:

<link rel="canonical" href="https://mywebsite.com”>

Wherever you have potential duplicate pages on your site, you can use the canonical tag to point to the one you want the search engines to use. Be aware though that there are other options to canonical tags and an incorrect implementation of canonical tags can easily be worse than no tags at all.

The question of whether to use a relative or absolute URL is quite a technical one. But given its potential impact on those vitally important search engine rankings, it’s a question you should address, or at the very least, grasp its potential implications.

New call-to-action

Published by Keith Errington December 12, 2017
Keith Errington