Learn more about the different files and folders Magento needs to operate

This part of the Magento tutorial will provide detailed information regarding the Magento’s default files and folders structure.

As we all know that Magento is configuration based MVC developed in PHP language. Magento uses zend framework as a base library. Magento has very powerful yet simple structure. Magento has very flexible and defined directory structure. In this post we will explore Magento directory structure and some important files. We will also explore purpose of the different directories of the Magento. Also the directories where all configuration files are placed.

Before going further I am assuming that you have already installed Magento and have some knowledge about to use magento admin part.

Here we will discuss top level directory of the magento and then we will explore depth of some important sub-directories.  Further in this tutorial we will name “root” where your Magento is installed.


on the top root magento has 11 directories. Different directories has some different purposes. Apart from directories magento root folder has some files as well. Some files are only for information purpose like LICENSE.txt, RELEASE_NOTES.txt etc. You can delete informative files from your production. But please do not delete any files about which you do not have any knowledge. Further in this tutorial we will discuss  we will discuss every root level directory of magento.

The files and folders included in the main directory are as follows:

  • .htaccess – contains mod_rewrite rules, which are essential for the Search Engine Friendly URLs. There you can also find standard web server and PHP directives that can improve your web site performance;
  • .htaccess.sample – this is a backup of the .htaccess file. If you modify .htaccess it can be used in order to get the default settings;
  • 404 (directory) – The folder stores the default 404 template and skin for Magento;
  • app (directory) – This folder contains the modules, themes, configuration and translation files, Also there are the template files for the default administration theme and the installation;
  • cron.php – a Cron Job should be set for this file. Executing of the file on a defined time period will ensure that the complicated Magento caching system will not affect the web site performance;
  • downloader (directory) – This is the storage of the web downloader files. They are used for the installation and upgrade of Magento through your browser;
  • favicon.ico – the default favicon for Magento. A small icon that is shown in the browser’s tool bar once your website is loaded;
  • index.php – the main index file for Magento;
  • index.php.sample – A backup of the default index file. It can be used to revert the changes in a case of a index.php modification;
  • js (directory) – Contains the pre-compiled libraries of the JavaScript code included in Magento;
  • lib (directory) – The Magento core code is located in this folder. It contains the software’s PHP libraries;
  • LICENSE_AFL.txt – The Academic Free License under which the Magento software is distributed;
  • LICENSE.txt – The Open Software License under which the Magento software is distributed;
  • media (directory) – This is the storage of the Magento media files – images out of the box, generated thumbnails, uploaded products images. It is also used as a container for importing images through the mass import/export tools;
  • mage (in versions older than this tool was called pear) – The file controls the automatic update through the downloader script and SSH. It handles the update of each individual Magento module;
  • php.ini.sample – This file contains sample PHP directives that can be used in order to modify your PHP setup. If you want to alter the default setup edit the file and then rename it to php.ini;
  • pkginfo (directory) – Contains files with information regarding the modules upgrades’ changes;
  • report (directory) – This folder contains the skin of the Magento errors reports;
  • skin (directory) – There are located the themes files – images, JavaScript files, CSS files, Flash files. Also there can be found the skin files for the installation of skins and administration templates;
  • var (directory) – Cache, sessions, database backups, data exports and cached error reports can be found in this directory;

If you want to modify an existing template or set a new one you should know that the template files are separated in 3 folders:

  • /app/design/frontend/default/YOUR_TEMPLATE_NAME/layout/ – Contains the .xml files that define which modules should be called by the template files and loaded in defined areas on the site;
  • /app/design/frontend/default/YOUR_TEMPLATE_NAME/template/ – Contains files and subfolders that structure the final output for the users using the functions located in the layout/ folder;
  • /skin/frontend/default/YOUR_TEMPLATE_NAME/ – Contains the CSS, images, JavaScript and Flash files related to the template;


That’s it Thank you for watching @thinknowledge.com