domain_redirect
59 sites
Security covered
Makes redirects domain-aware, allowing the same source path to redirect to different destinations depending on the active domain.
Features
- Adds a Domain field to redirects — scope a redirect to a specific domain or leave it global (all domains).
- Domain-specific precedence — when the same source path has both a domain-specific and a global redirect, the domain-specific one wins.
- Domain column and filter in the redirect admin list for easy management.
- Domain-aware unique hash validation — the same source path can have different redirects on different domains.
Requirements
Configuration
No configuration is needed. Once installed:
- Go to Administration > Configuration > Search and metadata > URL redirects.
- When adding or editing a redirect, select a domain from the Domain dropdown or leave it as All domains for a global redirect.
- Use the Domain exposed filter to filter the redirect list by domain.
How it works
- Adds a
domain_identity reference field to the redirect entity viahook_entity_base_field_info(). - Decorates the
redirect.repositoryservice to filter redirect lookups by the active domain during request handling. - Replaces the
RedirectUniqueHashentity constraint with a domain-aware version that allows the same source hash for different domains. - Modifies the database index on the redirect table from a unique key on
hashto a composite index on(hash, domain_id)for query performance.
Note
Starting with 2.x, this module was completely rewritten with no upgrade path from prior versions (7.x / 8.x). The original module used custom redirect paths (/domain-redirect/12345). The 2.x version integrates with the Redirect module instead. See HISTORY.md in the repository for details about the original module.