Google’s John Mueller recently stated that, for the most part, it doesn’t matter whether you use absolute or relative URLs when linking to pages internally.
This topic was brought up in a recent Google Webmaster Central hangout where the following question was asked:
“In your opinion, which ultimately is best to use when doing internal linking – absolute or relative URLs?”
In response, Mueller presents two different scenarios where absolute and relative URLs may or may not matter.
Scenario 1: Perfect Site Structure
In a theoretical case where a site has a perfect structure – meaning it has correctly implemented canonicals and a single uniform domain – then it doesn’t matter at all if you use absolute or relative URLs.
In this scenario, Mueller recommends using whichever is easier for you to implement with the CMS you’re using. “Use whatever makes sense,” Mueller says.
Scenario 2: Imperfect Site Structure
If your website does not have a theoretically perfect structure, which Mueller says most websites probably don’t, then there may be some benefit to using absolute URLs. With absolute URLs, Google can find its way back to the preferred version of the page.
If you’re unable to use absolute URLs then you can still help Google find the preferred versions of URLs by using the rel=“canonical” tag. So, ultimately, you can use either relative or absolute URLs in this scenario as well.
Hear the full question and answer in the video below (starting at 31:33):
“Ultimately, I mean, your site has correctly implemented canonicals and has a single uniform domain being used so no duplicate domain issues. 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. Oftentime relative URLs make it easier to test things locally so maybe that’s better. That’s not something I would really worry about there. I would really leave it up to you, and if I were working on this website, I would see which of these were easier in this specific case with whatever CMS I’m working on, and just kind of use whatever makes sense there.
In the case where your website is not is not a theoretically perfect structure – which probably most websites are not – then working with absolute URLs, if you can, make sure they really point at the canonical versions of all the URLs you have. Probably makes a little more sense, because you don’t have to worry about things like what if Google or some other person ended up accessing the non-WWW version of the website.
With absolute URLs we always find our way back to your preferred version. In practice, you can also work around this by using the rel-canonical and generally figure that out there anyway.
So, in the theoretical perfect situation, use whatever makes sense. In the realistic situation I’d still say use whatever makes more sense for you.
One thing that sometimes comes up is that sometimes people try to use absolute URLs to fight against scrapers. From my point of view that doesn’t really work that well because most scrapers know how to deal with URLs.
So, absolute or relative, they’ll get around that anyway and there are probably smarter things you can do to work against scrapers if you’re seeing that’s happening with your website.”