How to find your absolute path: Difference between revisions
From Joomla! Documentation
Removed the link to the Joomla Tutorials article. The referenced page no longer exists. |
Added tags for Joomla 2.5 and Joomla 3. |
||
| Line 15: | Line 15: | ||
<?php | <?php | ||
$path = getcwd(); | $path = getcwd(); | ||
echo "Your | echo "Your Absolute Path is: "; | ||
echo $path; | echo $path; | ||
?> | ?> | ||
| Line 22: | Line 22: | ||
'''''IMPORTANT: For security reasons, delete this file as soon as you have ascertained the information you require.''''' | '''''IMPORTANT: For security reasons, delete this file as soon as you have ascertained the information you require.''''' | ||
== Joomla! 1.5 {{JVer|1.5}} == | == Joomla! 1.5 and Later {{JVer|1.5}} {{JVer|2.5}} {{JVer|3}} == | ||
In Joomla! v.1.5 | In Joomla! v.1.5 and later, the absolute path is set in the ''index.php'' file in the root directory to the constant [[JPATH_BASE]]. | ||
<source lang="php">define('JPATH_BASE', dirname(__FILE__) );</source> | <source lang="php">define('JPATH_BASE', dirname(__FILE__) );</source> | ||
Revision as of 21:49, 25 July 2019
What is the Absolute Path?
The absolute path is the directory location on a server's drive where the Joomla! Website is located.
Joomla! 1.0 
In Joomla! v.1.0.x the configuration.php file would contain something like the following, however, it can vary depending on your server.
$mosConfig_absolute_path = '/home/joomla/public_html';
Usage
To find your absolute path, copy the following code into a text editor such as Notepad++ or TextEdit. Save the file as a .php naming it whatever you want. (For example, myabsolutepath.php.)
Using your FTP client software, transfer the file you have just created to the root folder of your Joomla Website. Open a Web browser and type in www.yourdomain.com/myabsolutepath.php.
<?php
$path = getcwd();
echo "Your Absolute Path is: ";
echo $path;
?>
IMPORTANT: For security reasons, delete this file as soon as you have ascertained the information you require.
Joomla! 1.5 and Later

In Joomla! v.1.5 and later, the absolute path is set in the index.php file in the root directory to the constant JPATH_BASE.
define('JPATH_BASE', dirname(__FILE__) );
Usage
Use the constant JPATH_BASE. This constant returns the absolute path to your Joomla! installation directory.
<?php
echo JPATH_BASE;
?>