Absolute links or relative links - which to use?
There seems to be a lot of difference in opinion about which links are most beneficial. So let me give you some facts.
What are absolute links?
An absolute link defines the location of the document in total including the protocol required to get the document, the server to get it from, the directory it is located in and then the name of the document itself.
An absolute link will look like this:
What are relative links?
A relative link on the other hand takes advantage of the fact that the server knows where the current document is. Thus, if we want to link to another document in the same directory, we don't need to write out the full URL. All we need to use is the name of the file.
For example, if we are looking at the link in the previous example, and we want to link to a file called index.html in the same directory, we need not write out the entire URL.
A relative link will look like this:
What does Google say about relative and absolute links?
Google recommends absolute links because it is possible for crawlers to miss some relative links.
'GoogleGuy' actually said "absolute links have less potential for getting messed up [when Google indexes your page]. Even though it should not make a difference, I recommend absolute links.”
What is the reality?
Unfortunately, we are faced with the fact that people often (yes, often) scrape the content from a website and then place it on their own site. So if you’re website is going to get scraped you may as well try and get a link back to your site. You can only make that happen with an absolute path!
The problem is not just with scrapers either. There are other quite legitimate ways to get your content show up on other websites; like RSS and web-services. I think that in todays world wide web, it’s no longer just a question of personal preferences - absolute paths are the safe and recommended way to link.
Another scenario is if someone links to your site using yoursite.com rather than www.yoursite.com, the search engine will follow the link and start crawling. If you are using absolute links then the search engine will crawl your site and only see the pages as . If you use relative links the the search engine could crawl your site as , which is probably not what you want to happen.
Undoubtedly most of your links from other sites will be linking to www.yoursite.com, not yoursite.com. If the search engine for some reason (and it does happen) decides to index your site with and not , then you could suddenly lose all of your search engine rankings because the non-www version of your site is indexed and the www version is not.
It's always good to be consistent with your internal linking, and it's great practice to make sure that all of your internal links specify exactly the domain name of your site so that there is no question of which pages should be indexed.
As a web developer and SEO, I can only recommend Absolute linking and for the following reasons:
1. They are much easier to manage as there is less chance of broken links appearing when moving documents or pages around.
2. There are many more occurrences of your full domain name in the source code, which can only be good.
3. They are much more recognizable to your visitors who are then more likely to bookmark your site.
4. Search engines can't miss or mess up any links when crawling your site.