Different Types of Links/URLs

Different types of links and their uses - Absolute urls, Relative urls, Root Relative url

On the web, there are many ways to link people to content. This is mostly relavant to people who create content (web pages, posts, blogs, etc).

These different link types have their own benefits.


Absolute URLs

An absolute url is one that includes the full domain name on the link. This kind of link is required in order to link across domains. Mainly you will use this link on your website if you need to send someone to a different website, or if you send a link in an email or text.

Using absolute urls in an email or text is required, because there isn't a "relative domain" in the context of the email or text in order for a relative link to know where to go. When someone is reading an email or text, they are reading it outside your website - so you have to use an absolute url.

It is best to only use absolute urls in this context - in an email or a text message, or if the need arises for you to link to someone else's website. The benefits of the relative url outweigh absolute urls in every other use case.

Example

It's easy to recognize an absolute url, because it has the domain (the .com part)

https://myfithive.com/about-fithive


Relative URLs

A relative url doesn't have the domain as part of the link. This kind of link is best to use when you are linking your pages between each other on the same website. The main benefit of this link is that it's shorter (doesn't require the domain to be part of the link) and if you ever change your domain you won't have to change your links throughout your website (replacing your old domain with your new domain).

Relative links always use the same domain that you are currently on - so if your domain is changed later (such as a rebrand or acquisition of a shorter domain name) all your links will still be valid (because they are relative).

A Root Relative URL starts with a forward slash "/". When a link starts with a forward slash, that means that the path to the page should go back to the root (the domain part). For example if a link is root relative, such as "/about-us", that means that if you are currently viewing the web page on myfithive.com then the link will be interpreted as myfithive.com/about-us.

If you are currently on a deeply nested page on myfithive.com such as https://myfithive.com/blog/view/the-top-5-things-you-need-to-do-everday-to-increase-sales then the /about-us will still return to myfithive.com when it builds the relative link, meaning it will still link to https://myfithive.com/about-fithive. This is how a root relative url works, it's relative to the top level because it starts with a forward slash "/".

Example

/about-us

Relative link (not root relative)

A relative link (not relative to the root), doesn't start with the domain or a forward slash. These types of links shouldn't be used as often as a root relative link because it might be easy to link a person incorrectly if the page changes where it's located.

Example

zapier - support article link to zapier integration

You'll notice that this link does not start with a "/" and does not start with the domain either. Because you are reading this article from https://myfithive.com/support/page/different-link-types and the link to the zapier support article is relative (but not root relative) - the interpretration of the final link will have the same path but with the final part (the page, "different-link-types") replaced with "zapier".

This will result in the final link being https://myfithive.com/support/page/zapier .

These type of page relative (not root relative) links are not recommended for common use.


Recommendations

Because root relative links remain relevant even after a domain change, FitHive recommends you use root relative links throughout your website instead of using absolute links. Only use absolute links when you link from an email or a text message (because it's required for the link to work correctly).

It's hard to remember every place you ever created a link between two pages on your website, so it's best to always use root relative links just in case your domain name is ever changed in the future.