Understanding Drupal File Structure - DFN #2

Read time: 6 minutes

User Profile

Hamad K

Apr 20, Sat

Drupal typically follows a modular and organized file structure. Here's a basic guide to navigating through Drupal's file structure as a part of our Drupal for noobs training series.

Navigating through:

  1. Root Directory:

    • The root directory will contain essential files like index.php, .htaccess, and the web directory, which is the main web root.

  2. Web Directory:

    • The web directory is the web root and contains the main Drupal files. It includes the core, modules, themes, profiles, and sites directories.

  3. Core:

    • The web/core directory contains the Drupal core files. You generally don't need to modify anything here.

  4. Modules:

    • The web/modules directory is where contributed modules are installed. Custom modules are often placed in the web/modules/custom directory as a part of standard practice.

  5. Themes:

    • The web/themes directory contains contributed themes. Custom themes are often placed in the web/themes/custom directory as a part of standard practice.

  6. Profiles:

    • The web/profiles directory is used for installation profiles. This is more relevant for developers creating distributions or specific site configurations.

  7. Sites:

    • The web/sites directory contains configuration settings, site-specific modules, themes, and files. It has subdirectories like default and example.com (where example.com is your site's domain). Configuration files (like settings.php) are often placed in the web/sites/default directory.

  8. Settings.php:

    • Important configuration settings are stored in web/sites/default/settings.php. It's crucial for database configuration, module and theme settings, and other site-specific configurations.

  9. Files:

    • The web/sites/default/files directory is where Drupal stores uploaded files, images, and other media.
  10. Vendor:

    • The vendor directory (outside the web directory) is where Composer installs external libraries and dependencies.

  11. Temporary Files:

    • Temporary files, like the Twig cache, may be stored in web/sites/default/files/php or a similar location.

​

Video Guide: (coming soon)


In next series, we'll be covering a standard .gitignore file for Drupal projects.

​

Interested in Publishing your knowledge and sharing it with the world?

Or ask anything about our services