Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

What Is an Absolute Path?

A path tells a computer where a file lives. This guide explains absolute paths and how they differ from relative ones.

Web Hosting2 min read4 steps

What is a path?

Files sit inside folders, and folders sit inside other folders. A path is the list of folders you walk through to reach one file. It is like directions to a house.

What is an absolute path?

An absolute path starts at the very top of the file system and gives the full address of a file. The top is called the root. On Linux, the root is written as a single slash /. An absolute path works from anywhere, like a full postal address with country and city.

Example on Linux:

/home/username/public_html/images/logo.png

This points to the file logo.png, starting from the top of the server.

On Windows, an absolute path begins with a drive letter:

C:\Users\Sam\Documents\notes.txt

What is a relative path?

A relative path starts from where you are now. It is like saying "next door" instead of giving the full address.

  • images/logo.png means: from this folder, go into images.
  • ../logo.png means: go up one folder first. Two dots mean "the folder above".
  • ./file.txt means: in this very folder. One dot means "here".

Absolute path in website addresses

In web pages, a link starting with a slash is relative to the site's top folder:

<img src="/images/logo.png">

This always looks in the images folder at the top of your site, no matter which page uses it. A full web address such as https://example.com/images/logo.png is also absolute.

How to find the absolute path of your site

  1. Log in to your hosting control panel and open File Manager.
  2. Go to your site folder, often public_html.
  3. Look at the path bar at the top. It shows the folder.
  4. Many control panels show your home folder under the settings or in a PHP info page. The full path often looks like /home/username/public_html.

If you cannot find it, ask Hostvento support. You can open a support ticket.

When do you need an absolute path?

  • Settings in a PHP script or a cron job. A cron job is a task the server runs on a schedule.
  • Backup and log settings.
  • Commands that must work from any folder.
Tip: Linux paths are case sensitive. Logo.png and logo.png are different files.

Quick recap

  • An absolute path is the full address of a file from the top folder.
  • On Linux it starts with /. On Windows it starts with a drive like C:\.
  • A relative path starts from your current folder.
  • Use absolute paths when a script or task must work from anywhere.