
Magento root directory (aka Magento root folder) is first and top-most directory in Magento file-tree hierarchy. This folder contains all Magento files and directories. Typically, this is in the same time, the website root directory as well.
Typical contents of Magento 1.x root directory:

In Magento 2.x you’ll see the following files and folders:
# ls -1 CHANGELOG.md CONTRIBUTING.md COPYING.txt Gruntfile.js.sample ISSUE_TEMPLATE.md LICENSE.txt LICENSE_AFL.txt app bin composer.json composer.lock dev index.php lib nginx.conf.sample package.json.sample php.ini.sample phpserver pub setup update var vendor
You can access Magento root directory and upload any files there via FTP, SSH or Filemanager. For filemanagement over SSH or FTP you can use one of SSH file clients, such as WinSCP or TotalCommander, Doublecommander, Filezilla.
In cPanel, you can access webFileManager and navigate to public_html directory. Other common locations for Magento root folder include:
- public_html (cPanel)
- /var/www/vhosts/[site_name]/httpdocs/ (Plesk)
- /www
- /var/www/
- /home/[your_username]/www
- /home/[your_username]/public_html
- /home/[your_username]/[site_name]/html (siteWorx/Nexcess)
- /srv/
When you need to find out full path from your current location in console/shell you can use
pwd
command:
-bash-4.1$ pwd /var/www/vhosts/example.com/httpdocsIf PHP code, you can print out
getcwd()
or _SERVER["DOCUMENT_ROOT"]
global variable or view it in phpinfo()
output, i.e. by uploading getcwd.php file with the following content:
<?php echo '<pre>'; echo "\nCurrent working directory is " . getcwd() . "\n"; echo '_SERVER["DOCUMENT_ROOT"] is '; echo $_SERVER["DOCUMENT_ROOT"]; echo '</pre>'; phpinfo(INFO_VARIABLES);
Unprotected Magento root directory can be discovered with our Magento Vulnerability scanner tool.