Last updated on February 13th, 2022 at 07:37 pm
The absolute path for a file or directory is not the same as the URI. The absolute path on the web server is /home/DIR/Xs/something/mydir/.
Here is how to find the absolute path on your web host for a given directory if you can’t find it, or it isn’t shown, in your web hosts control panel.
<?php
$getPath = getcwd();
echo $getPath;
?>
- Copy and paste the above code into a text file (take out the space between the less than sign and the question mark):
- Save the file as a PHP file, say abspath.php
- Upload the file into the root directory, or a sub-directory, of your website.
- In your web browser, go to http://www.mysite/abspath.php (or wherever you saved the file to)