The URL discussion has been absolutely beaten to a pulp regarding best practices for SEO and you will get varying opinions from different SEO companies. Are absolute URLs better for SEO than relative URLs? What is all the fuss about? I will get straight to the point. Relative URLs carry the same effectiveness as absolute URLs, and vice-versa. There is no difference regarding their impact with SEO. However, the general consensus suggests that absolute URLs are the accepted practice for SEO in place of relative links primarily on the basis that it is better to be safe than sorry. What reasons support this statement?
In its simplicity, a URL really is just an address to the location of a file on a server. When setting up URL links within a site, you can choose between two basic options: absolute URLs or relative.
Absolute URLs, as the name suggests, constitute a URL in its entirety. It defines the complete, designated path to a website file. For example, this would be like using a complete street address to locate someone's home. The person's name, street address, city, state, zip code, and country, all direct you to a specific location. Therefore, it is important to understand that each URL should be entirely unique. While URL patterns can be similar, and duplicate content can occur on different pages, absolute URLs are distinct. To illustrate, consider the URL below:
The designated domain in the URL structure, mydomain.com, maps to an IP address, which in turn directs to a specific server on a network. This might be like providing the city, state, or country in a street address. Next, the /myfolder/mypage.html portion of the URL details the rest of the path to the specific file location on the server. Again, we can compare this to the street address and zip code of a location. Therefore, this URL cannot point to one designated server location and path, and then also point to another server location simultaneously. This would be like an individual trying to use one address and be in two different places at once. Keep in mind that unethical and malicious means exist which can imitate URLs falsely, but that is for another discussion. The web server handles all the behind the scenes associations to locate the file on the server.
Let us consider the difference of a relative URL.
In a relative URL, the link is simply relative to the current document location. For example, the link below does not contain a full path by including the domain:
<a href=" /myfolder/mypage.html">
The browser will construct this link with whatever "host," or domain name has been passed in the page header. In other words, if you are on a page with the domain "www.cheapdomain.com," the link would translate to
Relative links are convenient since they can easily accommodate domain changes, and are easy to implement. So what is the problem with relative links? In a perfect world nothing is wrong, but relative links, or URLs, can become ambiguous and no longer possess the same, definitive uniqueness involved with the use of an absolute URL. Consider the street address example once more. Imagine that you are only given the street address to find someone's home, but you do not know the state, city, or zip code. How would you locate the house? Unless you are already in the correct state and city the address is ambiguous. It could be anywhere and you would be lost as to how to find the house.
Unfortunately, in an imperfect Internet world mistakes and weird things do occur. And relative links are no exception. Like the street address example, relative URLs run the risk of becoming incomplete links - lost and unable to find their intended location; incapable of asking for directions like the stereotypical male.
If you do opt for a relative URL setup, however, then highly consider implementing a base tag into the page headers of your website. For example:
<base href="http://www.mydomain.com" />
A base tag will assure that all relative links on your site will resolve to the appropriate domain that you designate within the tag. Furthermore, since relative links can also be more susceptible to hijacking, and can be the cause of duplicate content, base tags will likewise help to safeguard against these issues.
So how does this choice of URL structure affect SEO? Is one better than the other or is it all just relative (no pun intended)? There does not seem to be any empirical evidence to support one usage or the other, or suggest that there is a definitive right way. Either work for SEO purposes, but again the consensus suggests absolute URLs as a good SEO practice on the basis of "just in case," as it is better to be safe than sorry. As Google suggests, on the topic of "canonical" links, but applying to all links, "...we recommend using absolute links to minimize potential confusion or difficulties. If your document specifies a base link, any relative links will be relative to that base link."
You don't leave your doors unlocked at night, just in case someone does decide to break in. You don't drive around without car or health insurance in case a random accident happens. Likewise with relative links, you may do everything right, but you cannot always count on external events or people. A certain ambiguity exists with relative links, which denotes uncertainty and doubt. Why not be certain and follow an absolute structure, "just in case." It is better to be safe than sorry.