An absolute URL is one that solely contains the path. The directory and slug are both included in the path, which is everything that comes after the domain. It is assumed when linking a relative URL that it utilises the same protocol, subdomain, and domain as the page it’s on since relative URLs don’t include the whole URL structure.
Also Read: What is URL?
What is Relative URLs?
A relative URL may only be used to find a file if you are on the same page, in contrast to an absolute URL, which can retrieve a file from anywhere on the internet. Instead of providing an exact URL, it indicates where the file is in relation to where you are right now on the page (thus the word “relative”). A relative URL just consists of the domain followed by the location, for example, assuming that the visitor is already on the page.
With the link “/file1.html,”
<a href = “/file1.html”>
Also Read: What is Absolute URLs?
Why use Relative URL?
- If you simply need to utilise shorter relative URLs, you can code a website much more quickly. Relative URLs enable you to launch your freshly produced site without changing all the URLs to those of your live site if you are constructing a website and have live and developmental versions with distinct domains.
- Relative URLs can only be used to refer to resources under the same root directory, so keep that in mind.
This has been a guide to On Page SEO. You may also have a look at the following articles to learn more –