htmlurlrelative-url

Absolute vs relative URLs


I would like to know the differences between these two types of URLs: relative URLs (for pictures, CSS files, JavaScript files, etc.) and absolute URLs.

In addition, which one is better to use?


Solution

  • In general, it is considered best-practice to use relative URLs, so that your website will not be bound to the base URL of where it is currently deployed. For example, it will be able to work on localhost, as well as on your public domain, without modifications.