Skip to content

Configuration

Settings

Navigate to Administration > Configuration > System > Short URL (/admin/config/shorturl/settings) to configure the module.

Base36 slug length

The number of characters in randomly generated base36 slugs. Accepts values from 4 to 12 (default: 6). A 6-character base36 slug provides over 2 billion possible combinations.

Default redirect status code

The HTTP status code used for redirects. Options:

Code Meaning Use case
301 Moved Permanently SEO-friendly, browsers cache it
302 Found Temporary redirect
307 Temporary Redirect Preserves HTTP method

Default: 301.

Destination type

Controls what types of URLs can be used as destinations:

  • Both (default) — internal entity references and external URLs
  • External only — only full external URLs (e.g. https://example.com)

QR code format

The default format for QR code images served at /api/shorturl/qr/{slug}:

  • PNG (default) — raster image, universally compatible
  • SVG — vector image, scales without quality loss

Visit tracking

When enabled, the module records every redirect hit in the shorturl_visits database table via a lightweight HTTP middleware. Disabling this removes the middleware entirely for zero overhead.

Browser cache control (no-store)

When enabled, redirects include a Cache-Control: no-store header that prevents browsers from caching the redirect response. This ensures every visit is recorded by the middleware. Disable this if you prefer faster redirects at the cost of potentially missed visits.

Visit retention period

Controls how long visit records are kept in the database. Set a number of days (e.g. 90) to automatically purge older records on cron, or set to 0 (default) to keep all records indefinitely.

This is useful for high-traffic sites where the shorturl_visits table can grow very large over time.

Slug modes

Each short URL uses one of three slug modes, selected when creating the node. Available modes are filtered by the current user's permissions.

Custom

The user enters a vanity slug manually (e.g. promo, sale2024). Slugs are normalized to lowercase and validated for global uniqueness.

Permission: Use custom short URL slugs

Base36

A random slug is generated using cryptographically secure random bytes encoded in base36 (characters 0-9, a-z). The length is configurable in settings.

Slugs are case-insensitive

All slugs are normalized to lowercase on save. Unlike case-sensitive shorteners (e.g. bit.ly where Abc and abc are distinct), this module treats them as the same slug. This matches the Redirect module's default behavior and avoids user confusion with mixed-case URLs.

Permission: Use base36 short URL slugs

Auto-increment

Sequential numeric slugs (1, 2, 3, ...) managed via Drupal's State API. A safety check queries the database for the highest existing numeric slug to prevent collisions if the state counter is ever reset.

Permission: Use auto-increment short URL slugs

Multi-domain support

The Domain Short URL companion module adds per-domain slug scoping and per-domain auto-increment counters. The same slug can exist on multiple domains, each pointing to a different destination.

Permissions

The module provides nine granular permissions:

Permission Description
Use custom short URL slugs Create short URLs with vanity slugs
Use base36 short URL slugs Create short URLs with random slugs
Use auto-increment short URL slugs Create short URLs with numeric slugs
Access short URL list View the admin listing
Administer Short URL settings Access the settings form (admin)
Access Short URL API Use REST API endpoints
Import short URLs from CSV Bulk-create short URLs from a CSV file
View short URL statistics View stats on accessible nodes
View any short URL statistics View stats on all nodes (admin)

Redirect behavior

Redirects are managed automatically:

  • On node create/update: redirects are recreated with the current slug, destination, language, and status code.
  • On node delete: all associated redirects are removed.
  • On unpublish: redirects are disabled (not deleted) so the slug remains reserved.
  • On re-publish: redirects are re-enabled.

Multi-language

For each translation of a short URL node, a language-specific redirect is created. Additionally, a language-neutral fallback redirect (language code und) is created for each unique slug. This ensures the redirect works even when the visitor's negotiated language does not match any translation.

Admin views

The module ships two pre-configured Views:

  • Short URLs at /admin/content/short-urls — lists all short URL nodes with filters for slug, destination, mode, and publish status
  • Short URL visits at /admin/reports/shorturl-visits — lists individual visit records with filters for node ID, referrer, and country code