While relative URLs come with quicker coding, a staging environment, and faster load times, they can lead to issues with crawling.
You may consider updating relative links to be absolute instead of relative. Here’s how.
Table of Contents
Why Avoid Relative Links
Relative links are used on many websites but greatly increases the likelihood of crawling issues, wrong indexation, and duplicate content.
This is because relative reference URLs link to other pages based on a relative path from the location of the page itself.
Recommended Reading: What Is the Difference Between a Relative and an Absolute URL?
How to Change Relative URLs to Absolute
It is strongly recommended to use absolute references for URLs (include the full protocol and domain name portion in the URL) as a best practice to avoid a wide range of issues.
Here is an example of a relative URL:
<a href = "/xyz.html">
Whereas an absolute URL includes the entire address, from the protocol to the domain name, plus the location of the folder system. An absolute URL would look like this:
<a href = http://www.example.com/xyz.html>
To make the update, you’ll need to make changes via your CMS or the site’s code. You’ll want to find all instances of the relative URLs (i.e. only contains the location following the domain) and fill in the gap of the missing domain.
If you don’t have the access to make these changes through the CMS or the HTML, you can bring in the dev team for help.
How to Update Hyperlinks at Scale
Another way to change relative URLs to absolute is to leverage SEO execution platform ClarityAutomate.
This way, you’ll be able to implement site changes across thousands of pages, all in a matter of minutes.
- Select what you'd like to optimize: Links
To begin, we select “Links” in ClarityAutomate.
- Choose how you'd like to optimize it: Update Attribute
As opposed to adding or deleting an element, this fix requires us to update an existing link.
- XPath location: XPath of <a href> that needs to be updated
This step specifies the location of the hyperlink that will be updated.
- Attribute: href
The part of the <a href> to be updated is the href.
- New Value: The updated hyperlink with the absolute reference
As a last step, enter the new URL with the absolute reference. Remember, that means it’s the full URL of the page.
Before and After
With ClarityAutomate, a few minutes is all it takes to change relative URLs to absolute.