Multisite code snippets [for GovCon - 08/11/2026]

August 11, 2026
default author headshot Ashraf Abed
Share this post:

Create these files & folders

Folders:

  • web/sites/fairfax
  • web/sites/fairfax/files

Files:

  • Create web/sites/fairfax/settings.php
    • Copy it from web/sites/default/settings.php
  • Create web/sites/fairfax/settings.ddev.php
    • Copy it from web/sites/default/settings.ddev.php
  • Create web/sites/sites.php
    • Copy it from web/sites/example.sites.php

Put this at the bottom of web/sites/sites.php

$sites['fairfax.ddev.site'] = 'fairfax';

Put this at the bottom of web/sites/fairfax/settings.php

# WARNING: Passing in arbitrary variables for DB names is a significant security risk.
$databases['default']['default']['database'] = 'fairfax';

$siteDirName = 'fairfax';
$settings['file_public_path'] = "sites/$siteDirName/files";
$settings['file_private_path'] = "sites/$siteDirName/files/private";
$settings['file_assets_path'] = "sites/$siteDirName/files/assets";
$settings['config_sync_directory'] = "../config/sites/$siteDirName";
# Note: These file paths were selected for demo purposes
$settings['file_temp_path'] = "sites/$siteDirName/files/tmp";

Run these commands to create the DB & Route the URL

#// Create 'fairfax' db
ddev mysql -e "CREATE DATABASE fairfax;
GRANT ALL ON fairfax.* TO 'db'@'%';"

#// Route URL (fairfax.ddev.site)
ddev config --additional-hostnames fairfax
ddev restart

Ready To Launch Your Career?

Take the first step to launching the career you've always wanted. Explore Debug Academy classes today!

Explore Classes Contact Us