The discussion between absolute links and relative links remains to exist on in the SEO world. The individual importance of each has been challenged, but it is broadly considered that absolute links give better SEO value on the whole than relative links.
Several people believe that absolute links have less potential for getting messed up when search engines index your page. It shouldn’t create a difference, but many assume that this is reason adequate.
Moreover, content scrapers and RSS services may ‘repurpose’ your content legitimately (or not). In either event, shouldn’t a proper back-link be assigned to your site? This situation values absolute links. Although this is a insignificant argument, it’s still deserving for consideration.
Let’s see one of the most difficult and confusing parts about HTML, it is linking webpages to different pages and sites, particularly during absolute links and relative links get into action. But don’t get disturbed! Forming links — relative and absolute identical — is reasonably simple. Learn on, and with the conclusion of this article, you’ll understand the difference between these two kinds of links, as well as when and how to apply them.
However, it’s yet vital to learn how relative and absolute links serve their purpose, so read on…
First of all, as you may or may not recognize, you would probably use the below-mentioned code to create a link in HTML of a website:
<a href=”linkhere.html“>Click Me</a>
linkhere.html would be the particular page you need to link to, and Click Me would be in blue as anchor text, underlined link that the page shows.
In the example above, we applied a relative path. You can narrate if a link is relative if the path isn’t a full website address. (A full website address comprises http://www.) As you may have presumed, an absolute path does present the full website address. Here are some primary examples of relative & absolute paths:
The very first difference you’ll see between the two different kinds of links is that absolute paths always add the domain name of the website, including http://www., whereas relative links simply point to a file or a file path. If a user clicks a relative link, the browser sends them to that location on the current website. For that reason, you can only utilize relative links when linking to pages or files within your website, and you must apply absolute links if you’re linking to a location on another website.
So, if a user clicks a relative link, how does their browser come to know where to send them? Well, it resembles the location of the file relative to the page where the link displays. (That’s where the name originates from!) Let’s see our first example again:
<a href=”linkhere.html“>Click Me</a>
Above mentioned link points to a particular filename, with no path given. This indicates that linkhere.html is located in the same folder as the page where this link shows. If both HTML files were located in the root directory of the Website http://www.example.com, the original website address the user would be sent to is http://www.example.com/linkhere.html. If both files remained located in a subfolder of the root directory called files, the user would be sent to http://www.example.com/files/linkhere.html.
How about another case? Let’s assume, our http://www.example.com domain contained a subfolder named pictures. Inside the pictures’ folder is a file named pictures.html. The full path to this webpage would be:
Yet with us? Good. Let’s assume in this pictures.html file, we get a link:
<a href=”morepictures.html”>More Pictures</a>
If someone clicked that anchor text, where do you assume it would take them? If you said http://www.example.com/pictures/morepictures.html, you are right! You understand why it would send them there: because both files are there in the pictures subfolder.
Now, what if we required to utilize a relative link to display a page in another folder? If you need to link to a file in a subfolder of the current folder, give the file path to that file, similar to:
<a href=”/pictures/abroad-vacation/abroad.html”>Read about my abroad vacation.</a>
In this example, you’re saying the browser to see in the current folder (pictures) for a subfolder (abroad-vacation) that includes the file you want the visitor taken to (abroad.html). You can always link to as many subfolders as you want using this technique.
What if you need to link to a file in a folder above the current folder? You have to direct the browser to move up one folder in your relative link by placing two periods and a slash (../) in front of the filename or path:
<a href=”../about.html>Learn more about my Website.</a>
When the browser detects ../ in front of the filename, it studies in the folder above the current folder. You can apply this as many times as you need to. You can also instruct the browser to see in a subfolder of the directory above the current one. Applying the same example site from above, let’s assume we needed to create a link that would send the visitor to a page called stories.html found in another folder called stories. This folder is placed in the root directory, one folder up from the current folder, pictures. Here’s how a relative link to this file would show:
Now, let’s discuss absolute paths. Like we discussed earlier, absolute paths give the complete website address where you want the user to move. An absolute link would look like this:
<a href=”http://www.example.com”>Click here to visit Example Site.</a>
You need to apply absolute paths when linking to another Website, but you can also utilize absolute paths inside your website. This system is generally frowned upon, though. Relative links make it simple to do something like replacing your domain name without having to go through all your HTML pages, hunting down the links and replacing the names. As a bonus, they push you to keep your site structure neat and well organized, which is always a good impression.
Our web design experts & digital marketing strategist will give an eye-catching look to your website along with an internet marketing boost to transform your visitors into your customers with affordable pricing packages. We have more than 1000 clients who prefer only Dakshraj Enterprise when it comes to their online business needs.