Skip to content

Overview

Short URL is a URL shortener for Drupal built on node entities, with QR code generation, visit tracking, statistics, and a REST API.

For bug reports and feature suggestions, visit the issue queue.

Features

  • Short URL content type with three slug modes: custom vanity slugs, random base36 slugs, or sequential auto-increment slugs
  • Automatic redirects via the Redirect module — redirects are created, synchronized, and enabled/disabled in sync with node publish status
  • Multi-language support — per-translation redirects with language-neutral fallbacks so redirects work regardless of the visitor's negotiated language
  • QR code generation (PNG and SVG) using endroid/qr-code, with dedicated endpoints and a .qr path shortcut
  • Visit tracking via a lightweight HTTP middleware that records visits without full Drupal bootstrap on cached requests
  • Statistics dashboard on each short URL node with traffic charts (line and pie), referrer analysis, and country-of-origin mapping
  • CSV import for bulk-creating or updating short URLs from a file, with automatic format detection (e.g. YOURLS exports), via an admin form or Drush command
  • Bulk operations on the admin listing (delete, publish, unpublish) via checkboxes
  • REST API for programmatic URL expansion and statistics retrieval
  • Views integration with pre-configured admin listings for short URLs and visits
  • Granular permissions for slug modes, statistics viewing, API access, and administration
  • Optional country detection via the Smart IP module

Requirements

Optional

  • Smart IP (^5) — for visitor country detection
  • Domain Short URL (^1) — for multi-domain support with per-domain slug scoping, domain-aware redirects, and per-domain counters

Installation

composer require drupal/shorturl
drush en shorturl

The module installs a Short URL content type with four fields (slug, slug mode, destination, and an optional label), two pre-configured Views (admin listing and visits report), and a settings page.

Quick start

  1. Navigate to Content > Add content > Short URL (/node/add/shorturl).
  2. Select a slug mode (custom, base36, or auto-increment).
  3. Enter the destination URL.
  4. Save — the redirect is created automatically.
  5. Visit the Statistics tab on the node to see traffic data.

Maintainers