Users who download Drupal routinely add new modules directly to the /modules or themes to the /themes directory. The correct location of "sites/all/modules" is not at all clear and the number of files and directories in the Drupal core download makes it an exploratory effort to find the correct location. This issue's goal is to simplify the Drupal root directory.

Proposed resolution

This issue has been going on for 6 years, please take into consideration the compromise that has already taken place. The scope of this issue is clear. These exact things have been agreed upon as what we're handling in this issue:

  • Move all directories other than "sites" and "profiles" into a "core" directory.
  • Move all files other than .gitignore, .htaccess, index.php, README.txt, robots.txt, and web.config into the "core" directory also.
  • Adjust code and documentation throughout core to reflect the new locations.

These things specifically are not covered by this issue:

  • Moving the "profiles" directory to "core/profiles".
  • Moving "sites/all/*" to the root directory.
  • Any other changes to the "sites" directory, such as removing "sites/default" or relocating settings.php.
  • The addition of a "docs" directory.

See comment #121 for information about the "profiles" directory and other omitted changes.

Remaining tasks

This issue was RTBC at one point but now is postponed to let all the bugs get worked out of D7/D8. This issue is on hold until November 1, 2011 per Dries' comment in #254. In late October, this patch needs a reroll to prepare it for commit.

User interface changes

None, other than the directory structure changing.

API changes

A side-effect is documented in #124, where paths such as "profiles/sites/all/modules" or "modules/sites/all/modules" are no longer parsed. The addition of the "core/" prefix brought this issue to light, it could be considered a minor bug-fix.

Original report by kbahey


Currently, themes, modules and configuration files are all under separate directories in the directory where Drupal is installed (root directory). Also, several files exist in that directory, such as various .txt files.

This causes several issues:

1. Clutter in the root directory.

2. Base Drupal is intermixed with files that site admins install (e.g. themes, theme engines, modules, directory for images, sites directory, ....etc.).

3. Upgrades are problematic because of that intermixing.

This issue was discussed in the forums, then on the developers mailing list.

Here is a summary of what was discussed so far:

Ideally, core Drupal will be in one directory called drupal under the root directory, with only the index.php and .htaccess at the same level.

Another directory called custom will hold the configuration directory, the site admin installed modules, and site admin installed themes.

So, the end result would be:

public_html (root directory)

All the above would be included in the Drupal tarball, and should never need to be changed by a site admin in a normal install. The settings.php provided will contain localhost.

The following directory will be included in the tarball, with an empty structure (directories, and no files).


Users then start by copying the drupal/sites/default/settings.php to:

Drupal core will search the custom/sites directory first for configuration files, then if it cannot find any, it will go to the drupal/sites/default/settings.php. We should discourage (or better: prevent) adding any directories under drupal/sites other than the default directory.

Site admins then add their public/html/custom/sites/hostname/settings.php as needed, and can even add site specific themes and modules under each site directory as they do today.

Upgrades then consist of simply copying a new drupal directory to replace the existing one (and for backup, people can rename the old one to drupal-4.6 in case they want to go back), and copying the new index.php over the old one. They can then upgrade their own modules in separate directories.

The user's content (images, movies, flat files of any kind) is not affected in an upgrade, and the site admins are advised not to change the 'drupal' directory in any way.

The .txt files can be moved into doc directory under the drupal directory.

#299 drupal.core_move_22336_299.patch495.85 KBquicksketch
PASSED: [[SimpleTest]]: [MySQL] 33,771 pass(es).
[ View ]
#297 drupal.core_move_22336_297.patch494.4 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] 33,759 pass(es), 1 fail(s), and 0 exception(es).
[ View ]
#292 drupal.core_move_22336_292.patch494.25 KBquicksketch
PASSED: [[SimpleTest]]: [MySQL] 33,762 pass(es).
[ View ]
#291 drupal.core_move_22336_291.patch494.74 KBquicksketch
PASSED: [[SimpleTest]]: [MySQL] 33,759 pass(es).
[ View ]
#288 drupal.core_move_22336_288.patch659.75 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal.core_move_22336_288.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#227 drupal.core_move_22336_227.patch481.74 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal.core_move_22336_227.patch.
[ View ]
#224 drupal.core_move_22336_223.patch961.91 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal.core_move_22336_223.patch.
[ View ]
#208 move.patch356.58 KBtstoeckler
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#204 drupal.core_move_22336_204.patch7.18 MBrfay
PASSED: [[SimpleTest]]: [MySQL] 31,434 pass(es).
[ View ]
#202 drupal.core_move_22336_202.patch7.14 MBrfay
FAILED: [[SimpleTest]]: [MySQL] 31,418 pass(es), 12 fail(s), and 5 exception(es).
[ View ]
#200 drupal.core_move_22336_200.patch7.12 MBrfay
FAILED: [[SimpleTest]]: [MySQL] 31,398 pass(es), 29 fail(s), and 8 exception(es).
[ View ]
#197 drupal.core_move_22336_197.patch7.02 MBrfay
FAILED: [[SimpleTest]]: [MySQL] 31,393 pass(es), 31 fail(s), and 9 exception(es).
[ View ]
#193 drupal.core_move_22336_192.patch7.02 MBrfay
FAILED: [[SimpleTest]]: [MySQL] 28,655 pass(es), 92 fail(s), and 95 exception(es).
[ View ]
#180 drupal.core_move_22336_180.patch7.02 MBrfay
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#172 drupal_core_move.patch345.86 KBboombatower
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#168 dashboardcssandprofiles.patch518 bytesRobLoach
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch dashboardcssandprofiles.patch.
[ View ]
#165 drupal_core_move.patch474.1 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#158 drupal_core_move.patch472.63 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_core_move_4.patch.
[ View ]
#154 drupal_core_move.patch472.63 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#145 drupal_core_move.patch473.71 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_core_move_2.patch.
[ View ]
#140 drupal_core_directory.patch18.72 MBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#138 22336_138_git_apply.patch.txt472.93 KBscor
#134 22336_132_1.patch18.73 MBscor
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#125 drupal_core_move.patch158.11 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_core_move_1.patch.
[ View ]
#122 drupal_core_move.patch145.58 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_core_move_0.patch.
[ View ]
#121 drupal_core_move_commands.txt502 bytesquicksketch
#121 drupal_core_move.patch159.2 KBquicksketch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_core_move.patch.
[ View ]


dww’s picture

Status:Fixed» Closed (fixed)
sun’s picture

Some updates for everyone involved here:

1) We resolved the issue with core installation profiles in:
#562042: Search for install profiles in sites/[all|site]/profiles folders, and move core profiles into /core/profiles

2) It was heavily discussed as part of this issue, but it doesn't look like we created a follow-up issue for it, so I created one:
#1724252: Allow and encourage top-level directories instead of /sites/all/* directories


Furthermore, I hope there's an issue somewhere that essentially sorta enables what this entire /core directory change intended to improve — better in-place updating/upgrading of Drupal core. I actually don't think I've seen an issue for that yet?

Alan D.’s picture

An additional side effect, I am not sure if it is known or documented

Creating a symbolic links for core will break authorize.php, install.php and upgrade.php when trying to determine DRUPAL_ROOT

// This will always follow the real path!
define('DRUPAL_ROOT', getcwd());

I know this worked in Drupal 6 (multiple links to modules, misc, etc), but I am not sure about Drupal 7 but I can not see anything that would prevent this from working there.

Related: #1672986: Option to have all php files outside of web root., #1116144: Customizable locations for Drupal core folders (constants DRUPAL_CORE, DRUPAL_SITES)

While we never do this on production servers, I have done this on developmental boxes to reduce the amount of cluster locally and would probably be useful to exclude core from the repositories too for speed / less disk space.

Size 3 Oct 2012: 16,446,458 bytes
Actual Disk Drive space: 25,219,072 bytes

If my math is correct, 150 projects creates 3.5 GB storage for just having core included.

I have created a followup issue here: #1801728: Single HTTP point of entry for core (symbolic link for the core folder fails)

Alan D.’s picture

Issue summary:View changes

Explaining postponement.