Coding for SEO: Absolute versus Relative Linking
How you code is an important part of SEO. In a web page’s HTML code, you have two ways to include a link: relative links and absolute links. An absolute link is a link that contains the whole URL of the file you’re linking to. When it appears in code, it looks the same as when it appears in the browser’s address bar:
<a href=“http://www.classiccars.com/fords/mustangs/tireoptions.html”>Anchor Text</a>
That’s the whole file directory in the link itself. A relative link looks like only part of a full-path URL:
<a href=“tireoptions.html”> Anchor Text</a> <a href=“../tireoptions.html”> Anchor Text</a>
When designing your website, it’s not a good idea to use relative links, especially if you’re building your site from the ground up, so you won’t have the added headache of verifying page and media final placement. When you use a relative link, it works only in relation to the next directory up.
For example, a link from mustangs/paintoptions.html to <a href=“tireoptions.html”> takes you to the intended page only if your site has a mustangs/tireoptions.html for it to link to.
If the pages that were linking out were to get moved somewhere else, the relative link would no longer work because where it linked to would no longer be valid. So if the page was moved from the /mustangs directory to the /mustangconvertible directory, the relative link of <a href=“tireoptions,html”> would break because there is no tireoptions.html page in the /mustangconvertible directory.
An absolute link is easier to maintain in situations like this because it’s very clear what you’re linking to. With absolute links, the links still work, even if the pages move.
Use the fully qualified URL (that is, the link target that begins http://domain.com) every time you create a link. Not only is it easier for the engines to understand, but there are also fewer mistakes in the coding of the website, and any mistakes can easily be caught and corrected.