Understanding Absolute and Relative Paths

On a Linux Dedicated Server it is important to understand the relationships between one file and another, and also between those files and the server. It is also important to understand the relationship between the server and the Web.

Many scripts written in Perl, PHP, and others require some degree of configuration and may ask for the paths to certain file folders and/or programs. Usually these scripts will ask for the absolute paths or server paths rather than relative paths.

Absolute Paths

There are two types of absolute paths you should know. One is the website path or whatever follows the domain name. For example, the path to index.html could be:


That, however, is not the true path on the server, which views the file in relation to its place in the filesystem. For example, the actual server absolute path could look like:


From this you can conclude that whatever is placed in the /home/user/www/html path will be displayed at http://www.yourdomain.com/

Relative Paths

A relative path is viewed in relation to the folder or directory the user is currently viewing. On the web, a relative path could be:


When linking HTML, CSS and other types of files, you can use relative paths like this:

(This will point to the address

Typically, scripts that require paths to programs, such as Sendmail, will need the absolute paths to those programs, such as:

(Be sure not to include a trailing slash).

If you or other users on your server ever experience File Not Found or Internal Server Error messages, you might need to check that the paths in user scripts are configured properly.