One microsite, reachable in every environment
LocalGov Microsites: Domain Alias automatically creates one Domain Alias per configured environment for every microsite domain on a LocalGov Microsites platform. Each microsite becomes reachable under a predictable hostname in every environment — local, stage, production — from the moment it is created, long before its real domain is pointed at the platform.
For a microsite www.my-site.se on a platform whose controller domain is controller.example.com:
www-my-site-se.stage.controller.example.com— stage (no configuration needed)www-my-site-se.sites.example.com— production behind a base domain of your choicewww-my-site-se.myproject.lndo.site— local development with Lando
The production alias doubles as a go-live tool: build and verify content on
production — optionally behind basic auth at the ingress — and simply repoint
the real domain when the site is ready.
Why this module exists
On a LocalGov Microsites platform, the domain is the microsite: the site, its admin UI and every editor link resolve through the hostname on the microsite's domain record. That makes the hostname a hard dependency, and in real projects it is rarely ready when you need it.
Microsite owners shouldn't have to wait for DNS. A microsite is usually created long before its real domain (say www.my-site.se) points at the platform — DNS, certificates and hostname config often sit with a third party and take days or weeks. This module generates a temporary alias on a domain the platform already controls the moment the microsite is created, so administrators get a reachable site from day one and can start building content immediately. The real domain is added later, with nothing else to change.
One microsite, every environment. Domain records live in the database, so a copy of production carries production hostnames everywhere else. Instead of hand-editing domains or maintaining local overrides after every database refresh, this module keeps one alias per configured environment alongside the production domain — pull production down to stage, preprod or Lando/DDEV and every microsite is immediately reachable under a predictable hostname.
Features
- Fully managed aliases — created when a microsite domain is created, replaced when its hostname changes (whichever form or code performs
the save), removed when the microsite is deleted. - Environment configuration UI — add any number of
environments with an optional base domain or a full{slug}
pattern; saving regenerates every microsite immediately. Generated DNS
instructions show exactly which wildcard records to create. - Local development aware — pick Lando, DDEV or a custom
pattern; local aliases are namespaced by the tool's project name
(LANDO_APP_NAME/DDEV_PROJECT) so a single wildcard
entry in your tool's config serves every microsite. - Editor visibility — the aliases appear as clickable links
on each microsite's Domain settings tab, and a views field adds an
"Environments" dropbutton to the microsites overview. - Operations support —
drush lmda:regenerate
for bulk regeneration, status report entries that warn about a missing
default domain or microsites lacking aliases, and a route-cache decorator
that keeps per-domain front pages from bleeding between domains.
Requirements
- Drupal 11.2+
- Domain (with Domain Alias), Group 3 and Group Context Domain
- Integrates out of the box with LocalGov Microsites Group (microsite creation wizard and domain settings tab)
Infrastructure. This module creates the Domain Alias records inside Drupal — it does not make the hostnames resolve. For each configured environment you also need:
- DNS pointing at the environment, normally a wildcard record (
*.microsites.example.com). The module generates the exact records to create. - A web server / hosting platform that accepts those hostnames — a wildcard virtual host, or the domains registered with your host if it requires that (Platform.sh, Acquia, Pantheon and similar).
- A TLS certificate covering them, typically a wildcard certificate.
- If your
settings.phpsetstrusted_host_patterns, a pattern that matches the generated aliases.
Post-installation
Configure environments at Configuration → Domains → Microsite domain
aliases (/admin/config/domain/microsite-alias). On platforms
where microsites are created at runtime, protect the domain and alias config
entities from drush config:import — for example with
Config Ignore; see
the README for the recommended patterns and first-import ordering.
Credits
Developed by Digitalist for
LocalGov Drupal microsites platforms.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Localgov ecosystem
Most installed first
Activity
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.x-dev | Dev | 11 | Development snapshot of the 1.0.x branch. Automatically creates one Domain Alias per configured environment for every LocalGov Microsites microsite domain. For production use, install the latest tagged release. | Sep 16, 2026 | |
| 1.0.0-alpha1 | Pre-release | 11 | First alpha release. Automatically creates one Domain Alias per configured environment for every LocalGov Microsites microsite domain. | Sep 16, 2026 |