Contensio logo

Link Shortener

Link shortener plugin for Contensio. Create short URLs on your own domain with click tracking.

About this plugin

Link Shortener — Contensio Plugin

Create branded short URLs on your own domain. Track click counts per link. Set expiry dates and choose between temporary (302) or permanent (301) redirects.

yourdomain.com/go/my-link  →  https://example.com/very/long/destination/url

The URL prefix (go by default) is configurable from the plugin settings.


Requirements

  • Contensio 2.3 or later

Installation

Composer

composer require contensio/plugin-short-links

No migration needed — this plugin stores data in the core contensio_plugin_entries shared table.

Manual

Copy the plugin directory and activate it from the admin plugin manager. No database migration is required.


Features

  • Custom slugs — set any slug matching [a-z0-9-]+, or generate a random one in one click
  • Click tracking — every redirect increments an atomic counter stored in the JSON data column
  • Expiry dates — links stop redirecting automatically after the configured date
  • Redirect type — choose 302 (Temporary) or 301 (Permanent, browser-cached) per link
  • Status control — mark any link Active or Inactive without deleting it
  • Optional label — add a human-readable name to identify links in the admin list
  • Settings hub card — shows total links and total clicks on the admin settings overview page

How it works

Public redirect

When a visitor hits yourdomain.com/{prefix}/{slug}, the plugin:

  1. Looks up the slug in contensio_plugin_entries
  2. Checks the link is live (status = active, not expired)
  3. Increments the click counter atomically via JSON_SET
  4. Issues the redirect to the destination URL with the configured HTTP status code

If the slug is not found or the link is inactive/expired, a 404 is returned.

URL prefix

The prefix is stored in plugin settings and defaults to go. The public route is registered after all service providers have booted so the configured value is always used.

To change the prefix, go to Settings → Link Shortener and update the URL prefix field. The change takes effect on the next request (no server restart needed).


Admin

Managing links

Navigate to Tools → Link Shortener in the admin sidebar.

Column Description
Short URL The full short URL with a copy-to-clipboard button
Destination The target URL visitors are redirected to
Clicks Total redirect count for this link
Status Active, Inactive, or Expired
Expires Expiry date, or if none set

Links can be filtered by status (All / Active / Inactive).

Creating a link

  1. Click New link
  2. Enter a slug or click Generate random slug
  3. Paste the destination URL
  4. Optionally set a label, expiry date, and redirect type
  5. Click Create link

Settings

Go to Tools → Link Shortener → Settings (gear icon).

Setting Default Description
URL prefix go The path segment before the slug: yourdomain.com/{prefix}/{slug}
Default redirect type 302 Pre-selected redirect type on the new link form

Data storage

Links are stored in contensio_plugin_entries with:

Column Value
plugin contensio/plugin-short-links
type link
title the label (or empty)
slug the short slug
content the destination URL
status active or inactive
data JSON: { "click_count": N, "expires_at": "YYYY-MM-DD", "redirect_type": 301|302 }

Customising the redirect view

This plugin does not render a view for redirects — it issues a direct HTTP redirect. There is no Blade template to override.

To customise the "link not found" response, override the standard Laravel 404 error page in your theme.


License

AGPL-3.0-or-later