Configuration¶
Navigate to Administration > Configuration > Domain >
Domain Short URL (/admin/config/domain/shorturl) to configure
the module.
Counter scope¶
Controls how auto-increment slug counters are managed:
- Per domain (default) — each domain maintains its own
independent counter. Domain A might be at slug
42while domain B is at slug17. - Global — a single counter is shared across all domains, identical to the base Short URL behavior.
The counter scope only affects the auto-increment slug mode. Base36 (random) and custom slugs are not affected.
Per-domain state keys¶
When using per-domain counters, the State API stores each counter
under the key shorturl.counter.<domain_id>. When State no longer
holds a domain's counter (after a reset, for example), the next
number is taken from the highest numeric slug already on the
domain. Each counter is locked while a short URL takes a number from
it, so two short URLs saved at the same time never get the same one.
Changing the counter scope forgets every per-domain counter, so that
switching back to per-domain counters continues after the numbers the
global counter gave the domain's short URLs in the meantime.
Domain field¶
Each short URL node has a Domain field
(field_shorturl_domain) that assigns it to a specific domain.
When left empty, the short URL behaves as a global (non-scoped)
redirect — the same as base Short URL behavior. With Domain Access
installed, the node is kept in step with the field: a short URL with
a domain is published to that domain only, and one without a domain
is published to all affiliates.
Access control¶
When Domain Access (a submodule of Domain) is installed, the domain selector on the node form lists the domains it lets the user publish to, through its Publish to any domain and Publish to any assigned domain permissions. This module narrows that list further:
- Users with the Create short URLs on any domain permission keep the whole list.
- Other users only see domains assigned to them via
field_domain_accesson their user entity, plus the domain the short URL already has, so editing it never moves it.
The CSV import applies the same two rules to each row's domain
column: a row naming a domain the importing user could not choose
on the form is refused with an error on the validation step. A row
without a domain is allowed, as "- Any domain -" is on the form.
So do REST and JSON:API, through a validation constraint on the domain field: a short URL cannot be created on, or moved to, a domain the user could not choose on the form. A domain the short URL already has is always kept.
Without Domain Access, all users with node creation permission see all available domains.
Slug uniqueness¶
Slug uniqueness is enforced per domain. Two short URL nodes can share the same slug as long as they are assigned to different domains. When no domain is selected, uniqueness is checked globally. Moving an existing short URL to another domain is refused when that domain already uses its slug, whatever its slug mode.