The Domain module in Drupal enables enterprises to run multiple regional sites from one codebase—reducing duplication, slashing maintenance costs, and accelerating time-to-market. In this guide you’ll find:
- Core concepts and business benefits
- Step-by-step configuration with context-sensitive tips
- Advanced edge cases and real troubleshooting
- Best practices, architecture notes, and next steps

Overview & Business Benefits
At its core, the Domain module injects a context layer into Drupal’s node-access system. Administrators define “domains” (e.g., “US Site”, “EU Site”) and then scope content, blocks, menus, and themes accordingly.
Key business wins:
- 75% reduction in redundant content across regions
- 40% faster editorial workflow with shared assets
- Single-point security patching and updates
- Consistent UX with local language, GDPR, and currency compliance
Architecture & Prerequisites
- DNS & SSL: Point all domains/subdomains to the same server. Use wildcard or SAN certificates.
- Webserver vhosts: Configure Apache/Nginx “Host” headers, all pointing at one codebase.
- Composer install:
composer require drupal/domain
- Enable module:
drush en domain -y
- Permissions: Grant administer domains to your site-builder role
Then navigate to Configuration → Domains → Manage Domains to begin.
1. Create New Domains
Within Manage Domains, click Add Domain and fill out:
- Label: (e.g., “EU Market”)
- Domain Name:
eu.example.com
- Theme Override: Optional per-domain branding
- Default Language: For localized fields
- Redirect Settings: HTTPS enforcement or 301 rules
Tip: Use consistent naming (Region-Code) for automation and reporting.
2. Assign Content to Domains
Every node has a Domain Settings tab:
- Select one or more domains.
- Optionally “inherit from parent” for taxonomy scoping.
- Save and clear caches (
drush cr
).
Edge Case: If using Views, add a filter on Domain Access: Domain ID to prevent cross-domain leaks.
3. Domain-Specific Blocks & Layouts
- Structure → Block Layout → Place block → Configure
- Under Visibility Conditions, add Domain is, select domains
- Save block
Performance Note: Too many visibility checks adds cache contexts. Where possible, group domains.
5. Theme & Branding Overrides
- Configuration → Domains → Manage Domains → Edit domain
- Select Theme override → Save
Edge Case: If your theme uses asset libraries, ensure URLs are relative or wrapped in base_path()
.
Advanced Use Cases & Integrations
- domain_roles: Domain-specific editorial permissions
- content_moderation: Stage content by region
- Views Reporting: Expose Domain ID filter
- GDPR Compliance: Trigger consent banners on EU domains
- CDN & Cache: Vary by host or cookie for domain scope
Troubleshooting & Debugging
Content Invisible on Domain
- Verify Domain Settings on the node
- Inspect
domain_access
tables in your database - Run
drush cr
anddrush domain:debug
Block or Menu Missing
- Check visibility conditions in Block config
- Ensure your theme region is active
- Confirm webserver vhost Host header
Theme Override Not Applying
- Ensure the override theme is enabled in Appearance
- Clear Twig cache:
drush config:import --partial
- Look for registry overrides in custom modules
Best Practices
- Share a base theme, layer domain-specific subthemes
- Limit domain assignments per content type
- Document naming conventions for domains, menus, and roles
- Use automated tests (Behat) to validate visibility
- Monitor performance impact via New Relic or Blackfire
Add new comment