Understanding Drupal File Structure - DFN #2
Read time: 6 minutes
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:
Root Directory:
- The root directory will contain essential files like
index.php
,.htaccess
, and theweb
directory, which is the main web root.
- The root directory will contain essential files like
Web Directory:
- The
web
directory is the web root and contains the main Drupal files. It includes thecore
,modules
,themes
,profiles
, andsites
directories.
- The
Core:
- The
web/core
directory contains the Drupal core files. You generally don't need to modify anything here.
- The
Modules:
- The
web/modules
directory is where contributed modules are installed. Custom modules are often placed in theweb/modules/custom
directory as a part of standard practice.
- The
Themes:
- The
web/themes
directory contains contributed themes. Custom themes are often placed in theweb/themes/custom
directory as a part of standard practice.
- The
Profiles:
- The
web/profiles
directory is used for installation profiles. This is more relevant for developers creating distributions or specific site configurations.
- The
Sites:
- The
web/sites
directory contains configuration settings, site-specific modules, themes, and files. It has subdirectories likedefault
andexample.com
(whereexample.com
is your site's domain). Configuration files (likesettings.php
) are often placed in theweb/sites/default
directory.
- The
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.
- Important configuration settings are stored in
Files:
- The
web/sites/default/files
directory is where Drupal stores uploaded files, images, and other media.
- The
Vendor:
- The
vendor
directory (outside theweb
directory) is where Composer installs external libraries and dependencies.
- The
Temporary Files:
- Temporary files, like the Twig cache, may be stored in
web/sites/default/files/php
or a similar location.
- Temporary files, like the Twig cache, may be stored in
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
We thrive by partering with visionary brands and driven individuals.
Say hello 👋