Absolute vs. Relative URL Linking: What’s the Big Deal, Anyway?
A website’s internal linking structure can have a big impact on your SEO program and your website. An age-old debate is using absolute URLs versus relative URLs when linking internally.
In this article, I’ll address what those are and which you should ultimately choose.
- What Is an Absolute URL?
- What Is a Relative URL?
- Absolute vs. Relative URLs: Which to Choose
- FAQ: How does the choice between absolute and relative URLs impact search engine indexing?
What Is an Absolute URL?
An absolute URL is a URL that includes the domain of the site. To be more precise, an absolute URL is the full URL address including protocol (HTTP or HTTPS), subdomain (if any), domain, path and file name.
Here is an example of an absolute URL used in internal linking:
<a href=“http://www.example.com/category/topic.html”>anchor text</a>
What Is a Relative URL?
A relative URL is a URL that only includes the path to a file or webpage. In other words, it includes only a part of a full URL.
Here is an example of internal linking using a relative URL:
<a href=“/topic.html”>anchor text</a>
A relative URL assumes that the link that is added is part of the same domain and follows the same path as the current page.
For example, if you link from http://www.example.com/category/topic.html using
<a href=“/subcategory/topic2.html”>anchor text</a>, the link will take you to http://www.example.com/category/subcategory/topic2.html.
Absolute vs. Relative URLs: Which to Choose
There are several different reasons that one might choose an absolute URL or a relative URL when linking internally. I’ll go over some of those reasons now.
Why People Choose Relative URLs
Absolute and relative linking can be used in new and existing websites.
Using relative URLs is typically a coding preference among web developers, particularly for new websites, because it is easier to move them from a dev environment to production.
Website migrations can be easier with sites that have relative URLs, too (think moving from HTTP to HTTPS or changing your domain name). The relative links will work right away without having to be redirected.
Some may also see slightly faster load times with relative URLs, too, but the difference is very small.
Why People Choose Absolute URLs
Duplicate content issues can creep up with relative URLs, but not with absolute URLs.
Let’s say you have an HTTP version of your website and an HTTPS version of your website (meaning you have not 301 redirected the HTTP version to the HTTPS). If you use an absolute URL when you link, there is no question which domain the webpage resides on because it contains the full URL path.
However, if you were using relative URLs, search engines like Google may assume that the link refers to both the non-HTTP version and the HTTPS version. In this case, the search engine may index both pages.
Another reason people choose absolute URLs is to preserve the crawl budget — the number of pages the search engine can crawl and index within a timeframe.
Google has indicated that bad links can impact the crawl budget. This includes the duplicate content issue that can arise with relative URLs.
The Verdict
An absolute URL — while potentially more work upfront — is easier to maintain in the long run. Not only is it easier for the search engines to understand, but it prevents links from easily breaking, prevents duplicate content issues and preserves the crawl budget.
Google has weighed in on this issue in the past. In 2018, Google’s John Mueller tweeted that the whole absolute versus relative linking doesn’t matter for SEO:
Nope, not for SEO.
— 🧀 John 🧀 (@JohnMu) July 4, 2018
But then in 2019, Mueller weighed in again with a more detailed and different explanation to the question of relative versus absolute URLs:
In that video, Mueller says: “So in that theoretical case where you have a theoretically perfect website, then it doesn’t matter at all if you use absolute or relative URLs. So from that point of view, use whatever is easier for you.”
He goes on to say:
“In the case where your website is not this theoretically perfect structure, which probably most websites are not, then working with absolute URLs — if you can make sure that they really point at the canonical versions of all of the URLs that you have — probably makes a little bit more sense because then you don’t have to worry about things like, what if Google or some user ended up accessing the non-WWW version of your website and it was loaded? With absolute URLs, we always find our way back to your preferred version.”
For all the reasons that Mueller listed in that video and those that we have listed in this article as well, absolute URLs are the way to go.
On a final note, Google recommends using absolute URLs in canonical links:
“Use absolute paths rather than relative paths with the rel=”canonical” link element. Even though relative paths are supported by Google, they can cause problems in the long run.”
Want more tips on link building? Get our free e-book The New Link Building Manifesto: How To Earn Links That Count.
Our SEO experts can help you build link equity that can boost your search engine ranking. Schedule a free consultation to find out how.
FAQ: How does the choice between absolute and relative URLs impact search engine indexing?
The choice between absolute and relative URLs can have a significant impact on how search engines index your website. Let’s explore this topic further to understand the implications and guide you towards making the right decision for your website.
The Basics of URLs: URL stands for Uniform Resource Locator and acts as the address of a webpage on the internet. It consists of various components, including the protocol (http:// or https://), the domain name and the path to the specific webpage.
Absolute URLs: An absolute URL provides a complete and specific location of a webpage. It includes the entire web address, starting from the protocol to the page name. For example, “https://example.com/blog/article.html” is an absolute URL.
Relative URLs: In contrast, a relative URL provides a shorter, more flexible address that depends on the context within the website. It only includes the path to the webpage relative to the current location. For instance, if we are on the “https://example.com/blog/” page, a relative URL for the article would be “/blog/article.html.”
Impact on Search Engine Indexing: Search engines crawl and index web pages to provide relevant results to users. The choice between absolute and relative URLs affects how search engines navigate and understand your website’s structure, influencing the indexing process.
Site Structure and SEO: Absolute URLs are more explicit and provide search engines with a clear roadmap of your website’s structure and hierarchy. This enables search engines to comprehend relationships between different pages and determine their importance.
Link Equity and Ranking: When absolute URLs are used, any backlinks or external references to your website contain the full address. This means that the link equity or authority passed from these external sources to your web pages is retained and not diluted.
Flexibility and Portability: Relative URLs offer greater flexibility when it comes to moving or renaming pages within your website. Since they are not dependent on the domain name, you can easily update and maintain the internal links without breaking them.
URL Consistency: Consistency in URL structure is important for both users and search engines. Using absolute URLs throughout your website ensures that the links remain intact even when reshaping the site’s architecture.
The decision whether to use absolute or relative URLs is important, so choose wisely. Understanding the implications we’ve outlined in this article will help you make an informed choice that aligns with your SEO goals and website structure.
Step-by-Step Procedure:
- Understand the differences between absolute and relative URLs.
- Consider your website’s structure and hierarchy.
- Evaluate the impact on search engine indexing.
- Assess the link equity and ranking factors.
- Analyze the flexibility and portability of relative URLs.
- Aim for URL consistency within your website.
- Optimize for buyer intent search terms.
- Implement best practices based on your specific needs.