Sometimes referred to as the file path or full path, the absolute path is the location of a directory or file in a computer. It contains the root directory as well as all other sub directories that contain the file or directory. Paths are used extensively in operating systems to represent file and directory relationships. They are also necessary to the operation of the internet and form the basis of URLs.
In addition to absolute paths, there are also relative paths. These define the location of a file relative to your working directory, or the directory you are currently located in. Absolute paths use a root directory that is usually at the top of the file tree. This means that no matter what directory you are currently in you can always use this path to locate a resource on the system.
To give you some examples, in Linux and Unix based operating systems and web servers the absolute path usually starts with a forward slash /
. Each directory is then separated by forward slashes.
Example:
/home/john/www/blog/index.php
In Microsoft Windows based operating systems and web servers it usually starts with a drive letter and is separated by backslashes.
Example:
C:\Windows\Users\john\html\docs\blog\index.php
On the internet, URLs follow the Unix convention of using forwards slashes to separate files and directories on servers.
This post was originally published in the wpbeginner glossary.