A machine-readable guide to this site for AI agents and language models is available at/llms.txt(https://dev.acquia.com/llms.txt on the production site).
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.
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.
sites.phpTo 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.
settings.phpTo 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.common.inc';
}
// You can add custom logic or overrides after the include.settings.php fileWhile 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')) {
// You must use '-settings.common.inc'.
// The legacy '-settings.inc' naming convention is outdated and causes live site outages on MEO.
require '/var/www/site-php/' . $_ENV['AH_SITE_GROUP'] . '/' . $AH_DRUPAL_SITE_NAME . '-settings.inc';
}To set the configuration split status based on the Cloud Platform environment, add the following PHP code:
$site_name = $_ENV['AH_DRUPAL_SITE_NAME'] ?? '';
if (!empty($site_name)) {
// Assumes the split name matches the site name exactly.
$config['config_split.config_split.' . $site_name]['status'] = TRUE;
}To enable site-specific configuration splits, evaluate the AH_DRUPAL_SITE_NAME variable. Because multiple sites share the same codebase and environments, this step ensures that each instance loads only its designated features:
$domain = $_SERVER['HTTP_HOST'];
$site_configs = [
'site1' => 'site1',
'site2' => 'site2',
'site3' => 'site3',
];
$config_dir = 'default';
foreach ($site_configs as $identifier => $dir) {
if (strpos($domain, $identifier) !== FALSE) {
$config_dir = $dir;
break;
}
}
$settings['config_sync_directory'] = '../config/' . $config_dir;If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.