Absolute vs Relative URLs
A well-thought-out URL structure is critical for the proper function, successful crawling and accurate indexing of your website. The main consideration is to configure all your URLs to a uniform format, whether relative or absolute. This article explains the difference between the two and covers the basics, to help you choose the best option that caters to your goals.
What is an Absolute URL?
An absolute URL provides all available data about a page’s location on the web.
We know that the protocol (HTTPS) and domain (www.somewebsite.com), can trace all levels of nesting, and gauge a page’s location on a website.
What is a Relative URL?
A relative URL provides only the tag of an absolute URL.
If you want to link to a product page from a category page, you would use the following HTML relative URL: <a href=”product”>.
It is assumed that if a relative link appears on a certain page, that exact page should be used as its root.
Now that you understand the difference between a relative link and an absolute link, let’s clarify their optimal uses.
Reasons to Utilize Relative Links
A relative URL path is a favorite option of web developers, since it greatly simplifies coding work. Rather than outlining the entire route, which can be tedious and time-consuming when working with thousands of pages, you can just code “/product,” and it is easy to understand that the page is located on www.somewebsite.com, under a certain category within the catalog.
Easy Shift from Staging to Production
If the staging environment for somewebsite.com is placed in a unique domain somewebsitestaging.com, an absolute URL for a product page would look like this: https://www.somewebsitestaging.com/catalog/category/product. With thousands of pages placed in a staging environment, you could find yourself faced with the daunting need to shift them all to somewebsite.com. It would take tons of time and energy to recode thousands of links.
Relative URLs exempt you from this headache. You can shift the entire website structure to production all at once, and tags prescribed in relative addresses will apply to the new domain. This is a much more effective way to utilize your development team’s resources.
Slight Increase in Loading Speed
Thanks to short URLs, pages upload a bit faster. However, you should not rely on relative links alone to increase loading speeds, since the acceleration is indeed slight. If your content takes too long to upload, dig deeper to fix more serious problems.
Like any other solution, the relative URL HTML format has some drawbacks. A key one is that a single relative URL <a href=”product”> can give birth to four absolute URL options:
If you do not choose a canonical version, Google will perceive all these versions as unique pages. Of course, as Google’s algorithm gets smarter, it automatically determines the main version. But mistakes are still possible, so you should not rely entirely on the digital mind.
Why is Duplicate Content Undesirable?
Some SEOs are afraid of being penalized for duplicate content. However, you will not get the same severe penalty as you would with spammy links. Still, poor crawling is one way your website may suffer. Google spends tremendous resources to scan the web for updates and reflect recent changes in search results. A limited crawl budget is allotted to each website. Its amount depends on the platform’s authority, size, complexity of its structure, and the frequency of updates.
If you have four website versions, your crawl budget may be insufficient to scan them all. Google will remain unaware of changes made on unscanned pages, and instead showcase outdated information in search dropdown. If Google regularly encounters duplicated content, it may decide to reduce your crawl budget and the frequency of visits to your platform.
Under these conditions, absolute URLs provide the optimal solution. Crawlers will see a single website version and not be distracted by duplicates, greatly increasing the chances of your updated content being featured.
Relative URLs allow you to easily shift your content from the staging environment to the production domain. But this comes with a caveat: competitors can just as easily scrape your platform’s content and place it on their domain, something you do not want to happen to your handcrafted brainchild.
Absolute URLs help to protect your intellectual property. Rather than rewriting web addresses for thousands of pages, scrapers are more likely to go looking for other unprotected platforms.
Creating Effective Absolute Links
If you plan to use absolute URLs, the following tips will help you establish a uniform format:
- When canonicalizing the major version of your website, give preference to the HTTPS protocol, since Google deems it more secure.
- Even though it does not directly influence your SEO metrics, it is better to use a version without www., since these four characters only serve to elongate your URLs.
- Explain the importance of absolute URLs to your dev team, since they may see the recoding of thousands of web addresses as a waste of time.
- Fix links in your internal navigation.
- Ask your team to notify you about any non-absolute URLs they stumble upon when working with the website.
- Use Screaming Frog or other similar tools to detect links that do not align with the generally accepted format.
- If you cannot fix all your URLs, canonicalize them to mitigate the risks of duplicate content and scraping.
Now you know the difference between relative and absolute URLs, and what purposes they serve. Each format has its unique advantages and disadvantages. Relative links greatly simplify the work of web developers, while absolute links provide greater security, resolve duplication issues, and help you make the most of your crawl budget.
Although many experts find the use of absolute links to be among the best SEO practices, do not rush to rewrite all your relative links. Thoroughly weigh the pros and cons of each option and match them with your priorities and goals.
The main thing is to use your chosen format consistently throughout your entire website, to reduce the risk of errors for both your web dev team and Google bots.