How To Easily Find Out Absolute Path of WordPress or Any Website

In this post, I’ll explain how to find the absolute path of your website;

Website Absolute Path

An absolute path, is the complete structure of directories, related to “root”, the first directory of the whole system. In Linux the root directory is known as:

/

From there, the most typical structure to the “absolute website path” or directory that contains your website¬†files would be:

/home/username/public_html

Or it can be anything as difficult as:

/data/multiserv/users/117832/projects/1654322/www

This structure can change depending on the server. If you have command line access, 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:

<?php
$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. http://www.domain.com/path.php

You will see the absolute path printed on the page.

This is method will work for WordPress or any other websites.
Thanks for reading, and questions welcome!

Leave a Comment