Redirect Icon

Redirect

Statamic 5 Statamic 6

Tests

Adds 301 and 302 redirects, and 403, 404 and 410 aborts, to your Statamic web site. Rules are managed directly from the Statamic control panel β€” no code or config changes needed.

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

composer require pecotamic/redirect

The package requires PHP 8.2+. It will auto register.

Usage

Installing the addon adds a Redirects entry of its own to the control panel navigation (it's a Collection under the hood, but kept out of the general Collections list to avoid mixing it in with your actual content), with one entry per redirect rule β€” so the list stays fast and searchable even with a large number of redirects. Its field labels follow the control panel's active language (German and English are built in). Each rule has:

  • Request URI: the incoming path to match, e.g. /old-page
  • Match type: Exact matches the path exactly, Starts with matches any path starting with it
  • Response: the HTTP status code to respond with β€” 301 (Moved Permanently), 302 (Moved Temporarily), 403 (Forbidden), 404 (Not Found) or 410 (Gone)
  • Target: the redirect destination, required for 301/302. Accepts a relative path (e.g. /new-page) or an absolute http(s):// URL

A redirect can be unpublished (via the entry's regular publish/unpublish control) to disable it without deleting it.

Upgrading from 1.x

Versions up to 1.1.1 stored redirects in a single "Weiterleitungen" global set instead of a collection. After upgrading, run:

php artisan pecotamic:redirects:migrate

This copies existing redirects into the new collection (an unpublished/disabled rule stays unpublished), then deletes the old global set. It's safe to run more than once β€” existing entries are skipped, not duplicated.