in Elftronix

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:

/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 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:

<?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.

Care and share, let's call it fair! -David

Twitter Button Facebook Button Google Button LinkedIn Button

Write a Comment

Comment

  • Related Content by Tag