1. Home
  2. Support
  3. Scripting
  4. What is the difference between a relative and absolute URLs?

What is the difference between a relative and absolute URLs?

Absolute URLs

Absolute URLs contain more information than relative urls, as they also include the protocol (e.g http://) and the domain name.

Example of an absolute URL:

<a href="http://yourdomain.co.uk/yourfolder">A Folder</a>

You must use absolute URLs when linking to other websites not located on the same domain, other wise the web browser will look for the file on the current domain and fail to load the desired page.

Relative URLs

Relative URLs are generally easier to work with as they are shorter and more portable, but can only link to pages on the same domain.

Example of a relative URL:

<a href="/yourfolder/">The Home page of my website</a>

Generally speaking it is best practice to use relative URLs within your website for development, as this allows easy deployment regardless of the domain name. eg /home.html will work on both mydomain.com and mydomain.co.uk. However relative URLs can cause issues when optimising a website for SEO.

Was this article helpful to you? 17 2

Classification: Public
Last modified: 2019/08/14 at 15:17 by Jamie