Multi-Experience Operations (MEO) allows you to fully manage your Drupal sites.php and sites/default/settings.php files in your code repository. Unlike Site Factory, which uses factory-hooks that allows you to inject your custom logic, MEO's approach requires you to include a specific require line in your files. This allows you to add your own custom logic before or after the core configuration of the platform is loaded.
How MEO manages multisites¶
MEO is designed to use a single docroot/sites/default/settings.php file for all sites in your codebase. When a request comes in, the configuration files automatically set a variable ($_ENV['AH_DRUPAL_SITE_NAME']) that identifies the correct site. The settings.inc file uses this variable to dynamically load the correct database credentials and file paths for the requested site. This allows you to add new sites through the MEO user interface without needing to commit new code for each site.
Configuring sites.php¶
To ensure your MEO codebase connects correctly, create or edit the file at docroot/sites/sites.php and add the following lines:
<?php
// You can add custom logic before the include.
if (file_exists('/var/www/site-php')) {
require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $_ENV['AH_SITE_GROUP'] . '-sites.inc';
}
// You can add custom logic or overrides after the include.
The preceding snippet loads the platform-generated array of domain-to-site-name mappings.
Configuring settings.php¶
To ensure your MEO application connects correctly, edit the file at docroot/sites/default/settings.php and add the following lines, typically at the end of the file:
<?php
// You can add custom logic before the include.
if (file_exists('/var/www/site-php')) {
require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $_ENV['AH_SITE_GROUP'] . '-settings.inc';
}
// You can add custom logic or overrides after the include.
Using a site-specific settings.php file¶
While the default method uses sites/default/settings.php for all sites, MEO also supports site-specific overrides. If a file exists at docroot/sites/<site-name>/settings.php, Drupal loads that file instead.
If you use this method, you must manually set the $AH_DRUPAL_SITE_NAME PHP variable before the require line.
For example, docroot/sites/site2/settings.php:
<?php
// Manually define the site name for the platform include.
$AH_DRUPAL_SITE_NAME = 'site2';
// ... (Your custom settings for site2)
// Load the MEO-managed platform settings.
if (file_exists('/var/www/site-php')) {
require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $_ENV['AH_SITE_GROUP'] . '-settings.inc';
}