This article's purpose is to explain what is a Relative, and what is an Absolute File Path.

First, though, we need to specify what is path.


What is a path?

A path is a sequence of directory names, usually leading to a file or directory.

A typical path in Windows looks like:


A typical path in Linux looks like:



Noted the two basic differences between Windows and Linux paths?

  1. A Windows path usually starts with a Drive letter like C: , while in Linux, the root directory of the system is symbolized using a slash (/)
  2. Windows paths use backslashes (\) while Linux paths use slashes (/)


What is NOT a path?

Many people mistake URLs for paths. It's true that they look alike with Linux paths, but there is a main difference.

URLs are used for accessing a page from the net, while the paths are usually used for accessing files, within a computer, or LAN.


What is an absolute path?

An absolute path is a path that starts right from the root of your computer file system.

In Windows, that means the inclusion of the drive letter (like C:) and in Linux, that means the inclusion of the root slash (/)

The two paths shown earlier, are both absolute paths.


What is a relative path?

A relative path, is a path starting from the Current Directory of your program. In our case, which is PHP, the Current Directory is usually the directory containing the file executed.

So, if we're on Windows, and the Current Directory is C:\Users\Christopher\, then to access the same file mentioned before, in the absolute path, we should only write Documents\Pictures\funny.jpg .

In Linux, with the Current Directory being /var/home/christopher/ we only need to write documents/pictures/funny.jpg to access the file.


For Joomla, we have the privilege to know, that almost everything is executed through the index.php file in the root directory of our site.

So, in our case, which we usually don't know the whole path above the root directory of our site, we use relative paths.


For example, to write a file in the root directory of our site, we only write the desired filename.

But if we would like to place a file in a module's directory, we would write the following path:



Feel free to request further information through our website's contact form.