Published on September 13, 2018 When I create links, should I use the whole URL or a part of it? What are Absolute Paths and Relative Paths?
When you create website links in your store/website, whether banner links, links in any text editor for a certain word that should lead others to another page, a menu link, and more, you can either copy the whole URL or copy a part of it (that is after your Top-Level Domain (TLD), such as ‘.com’, ‘.com.au’, ‘.ca’, etc.).
Important note: If you want to link to another website with a different domain name, or even your own website with a subdomain, you must always use the whole URL (absolute path).
Absolute Path versus Relative Path
If you copy the whole URL, that would be called the Absolute Path.
If you copy the part after your domain and TLD, that would be called the Relative Path. This only works on your own website for your own domain.
Examples (following the order of the above Absolute Path examples):
Important note: You must use the absolute path (whole URL) if you want to create a link in your domain that leads to your subdomain (www.example.com to test.example.com). There may be a way to do so using a script but that would be another discussion.
In summary, to make use of the relative path, you would copy the ‘/’ after the TLD (e.g., .com) along with the text after the ‘/’.
Using the last part (relative path) is the preferred way. If you ever decide to change your website’s domain name, your links would remain valid as your website would know that what comes after the TLD (e.g., .com) is part of your domain, whatsoever be your domain. If you were to use the absolute path (whole URL) and you later on change your domain, your link would take you to that older domain as it’s included in the link, and if that domain no longer exists, it will generate a page/server not found.
The above is true for any type of website, not just in our Ozcart online shop.