domain_shorturl
Security covered
Multi-domain awareness for the Short URL module. Adds per-domain slug scoping, a domain field on short URL nodes, and domain-aware redirects.
Features
- Per-domain slug scoping — the same slug (e.g.
/blog) can exist on multiple domains, each pointing to a different destination - Domain field on short URL nodes — assign each short URL to a specific domain
- Domain-aware redirects via Domain Redirect — redirects are scoped to the correct domain automatically
- Domain-aware visit tracking — the
shorturl_visitstable gains adomain_idcolumn so statistics can be filtered per domain - Domain-aware slug generation — auto-increment counters can be scoped per-domain or kept global
- Form integration — the domain selector appears on the short URL node form, with access control via Domain Access
- Configuration UI at
/admin/config/domain/shorturlfor counter scope settings
Requirements
- Drupal 10.3+ or 11.2+
- Short URL (^2)
- Domain (^3)
- Domain Redirect (^2)
Optional
- Domain Access (^3) — filters the domain selector on the node form by the user's assigned domains
Architecture
The module uses service decoration to extend the base Short URL services:
- DomainAwareShortUrlManager decorates
ShortUrlManager— injects the domain ID into redirects and visit records - DomainAwareSlugGenerator decorates
SlugGenerator— adds domain-scoped uniqueness checks and per-domain counters - DomainAwareVisitMiddleware replaces the base visit middleware to record the active domain on each visit
Installation
composer require drupal/domain_shorturl drush en domain_shorturl
The install hook automatically:
- Adds a
domain_idcolumn to theshorturl_visitstable - Adds the domain field to the short URL form and view displays
Uninstalling the module cleanly reverses these changes.