Hosting

  1. Home
  2. Support
  3. Hosting
  4. General
  5. 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 Folder

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:

The Home page of my website

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? Yes No
Click here for full details