Absolute vs. Relative Links: What’s the difference

No Comments

absolute vs relative links for seo

There has always been the debate that absolute links provide better SEO value on the whole compared to relative links as there are fewer chances of absolute links being messed up. While each has its advantages and disadvantages, the debate still continues. So, what are absolute and relative links?

Absolute Links

An absolute link defines a specific location of a web file or document. An absolute link includes the following:

  • the protocol used to get the document
  • the server to get it from
  • the directory it is located in,
  • the name of the document

 The example below shows an absolute link:

//<a href=”http://www.webdomain.com/webpagename.html”></a>

Absolute Link: For Outbound Links

Absolute paths contain the full URL, including protocol, website domain name, and optionally a specific file, subfolder, or page name. For example :

<a href=”https://www.seoisb.com/page2/”>Page 2</a>

The URL here, “ https://www.coder.com/page2/ ” can be entered in a browser’s search bar, and you will be taken to where you want to go. Some browsers allow the protocol, ” https: // ” to be dispensed with , you need to include it when coding absolute links to make sure they work for all visitors.

Absolute links are used to create links both between separate websites and internally. If you are linking to an external website, it is better to target a blank browser window to have the link open in a new tab, rather than driving visitors away from your site. This way the user will still see your site when they close the linked page. To ask the browser to open a link in a new window, you must add the “target =” _blank “” attribute. For example, you would link to the Google home page like this:

<a href=”https://www.services.com” target=”_blank”>Services</a>

Whether a link is opened in a tab or window depends on the user’s browser settings. Conversely, we will see that the relative links that link the pages of your website must always load in the same page of the browser .

Relative Links

With relative links, the search engine already knows the current location of the document. So, you will not need the whole URL, just the file name. The example below shows a relative URL.

//<a href=”webpagename.html”></a>

Relative Links: Only For Internal Links

The relative link contains the name of a specified file or page, which is related to the current path. If you keep all of your website files in one directory , you can link between pages as follows:

<a href=”page2/”>Page 2</a>

In this case, the link is only valid if it is placed in the directory where “page2.html” is located. When you click, the browser searches for “page2.html” in the directory of the current page and displays it. Of course, if you paste “page2.html” directly into a browser’s search bar, it won’t get you where you want to go. The path of the link is relative to the current document displayed by the browser, hence its name.

You will need to include a protocol and your domain name in the link to turn it into an absolute link:

<a href=”https://www.seoisb.com/blog/”>Blog</a>

Sometimes you will need to include more information than the name of a file to create a relative path. To come back to the last example, if “page1” resides in the root directory while “page2” resides in a sub-directory named “folder”, a relative link between these 2 pages must include the folder:

<a href=”folder/page2/”>Page 2</a>

Be careful, folder and file names are case sensitive in URLs! Domain names are not.

Now suppose you want to link on page2 that takes you back to page1. To create a relative path to a higher directory, just add a colon followed by a slash at the start of the link:

<a href=”../page1/”>Page 1</a>

Adding “../” tells the browser to search higher in the folder hierarchy to find the desired file.

Now imagine a folder structure like this:

Root: Page1
FileA: Page2
FileB: Page3

To create a link between page 3 and page 1, proceed as follows:

<a href=”../../../page1/”>back to page 1</a>

You can just add “../” anytime you want to move up, but what if you need to move up and then down?

For example, imagine your site looks like this:

Root: Page1
FileA: Page2
FileB: Page3
You want to go from page 3 to page 2: you must first exit from folder B, then go back down to Folder A.

<a href=”../FileA/page2/ “>Page 2</a>

 Read More: How Page Speed Affects SEO And SERP

Absolute vs Relative Link, What Do I Go For?

If you look at it theoretically, it shouldn’t make any difference what you go for. But according to SEO experts, absolute links don’t have the same associated risks for hurting your domain and authority as relative links do. This section will go through the pros and cons of both.

Absolute links offer the following advantages:

Efficiency

Relative links are shorter as they don’t include the website domain name and so help improve the efficiency of the code and reduce redundancy.

Staging environments

This has to do with website development; it helps developers when they are testing, updating, or changing the website. There’s a live website and a replicated version of it on the staging site of the domain. With relative links, developers don’t have to recode all the URLs, making it easier to change and manage the website.

The benefits absolute links offer to outweigh these. A flexible and efficient website is great, but it does come with its downsides.

Absolute links protect your site by minimizing the risks of damage to SEO and help maintain a good standing. How do they do that?

Protection from scrapping

Absolute links prevent scrapers from grabbing your website and putting it on a new domain. If you use relative links, scrappers can easily place it on a new domain, and it will work. With absolute links, you get added protection through the complexity as the added layer of details keeps scrappers away.

Help search engines ignore duplicate content

Absolute links reduce issues of duplicate content by ensuring that search engines like Google don’t have to translate between URLs to pick original content. One of the problems is that most of the time, relative links don’t redirect to the main URL, so you end up with multiple live domains.

The big problem with relative links is that most of the time, they are not properly set up to redirect to the main URL. When that is the case, the search engines will get to your website from any relative link, and to them, it will be different websites from different domains.

Most people fear that this situation will result in a duplicate content penalty, but it causes an even bigger problem, it is diluting the power of your domain and backlinks. How does that work? You have different links leading to different domains; this dilutes the authority instead of consolidating to one domain, which is terrible for SEO.

As you can figure out by now, from an SEO point of view, absolute links are better as they optimize SEO to its full potential and worth the extra effort.

Conclusion

If you are only linking pages that are all on the same website, it is customary to use relative links. And if you change your domain name , keeping all of your relative links will make the migration much easier.

Referencing level, the use of absolute URLs is however preferable: In certain cases, a misused relative link can be a source of content duplication. Relative links are also problematic in RSS feeds whereas using absolute links ensures that content always displays correctly. Finally, using absolute links for your images allows you to declare your ownership in image search results, which is also a great SEO point.It prevents identical or duplication problem on url.

If you are using relative links, but have duplicate issues, and you don’t have the time or resources to correct all of your links, canonicalizing all of your pages may solve the problem. The “rel =” canonical “” tag is a way to define search engine that specific url leads to the master or primary copy of web page.

As always if you have a problem that an article cannot solve, I highly recommend that you seek professional help. Codeur.com is here for that!

SEO Islamabad leading SEO company Pakistan are currently providing it’s incredible proven Search Engine Optimization (SEO) service across the Globe with multiple offices including in but not limited to Pakistan, UK, USA, Norway, Sweden, Canada!

About us and this blog

We are a digital marketing company with a focus on helping our customers achieve great results across several key areas.

Request a free quote

We offer professional SEO services that help websites increase their organic search score drastically in order to compete for the highest rankings even when it comes to highly competitive keywords.

Subscribe to our newsletter!

Fields marked with an * are required

More from our blog

See all posts