How To Easily Find Out Website Absolute Path

An absolute path, is the complete directory structure related to the root directory, which is the first directory in the whole system. In Linux the root directory is known as:


From there, the most typical structure to the directory that contains your website files would be:


Or it can be anything as difficult as:


This structure can change depending on the server. If you have access to the command line, with bash it’s as easy as typing “echo $HOME”.

Echo Absolute Path

If you don’t have shell access (command line), you need to create a simple php file and upload it to your website folder.

Open up your favourite text editor and add these lines:

$path = getcwd();
echo “Absolute Path: “;
echo $path;

Save it, let’s say as “path.php” & upload it to your public_html folder, or wherever the files are located for your website. Then open up the path.php file in your web browser, ex.

You will see the absolute path printed on the page.

Caring is sharing.. thank you! -David

Twitter Button Facebook Button Google Button LinkedIn Button

Write a Comment


  • Related Content by Tag