PHPackages                             justbetter/statamic-detour - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. justbetter/statamic-detour

ActiveLibrary[HTTP &amp; Networking](/categories/http)

justbetter/statamic-detour
==========================

Statamic addon for redirects.

0.1.0(2mo ago)299↓50%PHPPHP ^8.3CI failing

Since Jan 28Pushed 1mo agoCompare

[ Source](https://github.com/justbetter/statamic-detour)[ Packagist](https://packagist.org/packages/justbetter/statamic-detour)[ RSS](/packages/justbetter-statamic-detour/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (9)Versions (9)Used By (0)

Statamic Detour
===============

[](#statamic-detour)

[ ![JustBetter logo](./art/header.png)](https://justbetter.nl "JustBetter")This Statamic addon provides a flexible redirect management system for your Statamic projects.

Requirements
------------

[](#requirements)

- PHP ^8.3
- Laravel ^12.0
- Statamic ^6.3

Features
--------

[](#features)

- **Performance Mode**: Ensure redirects are only checked after Statamic determines a route doesn't exist (prevents slowing down valid hits)
- **Multi-Site/Locale Support**: Redirects can be global or scoped to a specific site handle
- **Storage Driver**: Option to store redirects in flat files (YAML) for version control OR Database for performance on massive sites
- **Path &amp; Regex Support**: Create redirects using simple paths or powerful regex patterns
- **Multiple Redirect Codes**: Support for 301, 302, 307, and 308 redirect codes
- **Control Panel Interface**: Manage redirects directly from the Statamic Control Panel

Installation
------------

[](#installation)

You can install this addon via Composer:

```
composer require justbetter/statamic-detour
```

Configuration
-------------

[](#configuration)

You can publish the config by running:

```
php artisan vendor:publish --tag=justbetter-statamic-detour
```

You can now find the config file at `config/statamic-detour.php`.

### Storage Driver

[](#storage-driver)

The package supports two storage drivers:

#### File Driver (Default)

[](#file-driver-default)

Store redirects as YAML files in your content directory. This is ideal for version control and smaller sites.

```
return [
    'driver' => 'file',
    'path' => base_path('content/detours'),
];
```

Or set via environment variable:

```
STATAMIC_DETOUR_DRIVER=file
```

#### Eloquent Driver

[](#eloquent-driver)

Store redirects in the database. This is recommended for larger sites with many redirects for better performance.

```
return [
    'driver' => 'eloquent',
];
```

Or set via environment variable:

```
STATAMIC_DETOUR_DRIVER=eloquent
```

When using the Eloquent driver, run the migrations:

```
php artisan migrate
```

### Performance Mode

[](#performance-mode)

The package supports two modes for checking redirects:

#### Basic Mode (Default)

[](#basic-mode-default)

Redirects are checked early in the request lifecycle, before Statamic's routing.

```
return [
    'mode' => 'basic',
];
```

Or set via environment variable:

```
STATAMIC_DETOUR_MODE=basic
```

#### Performance Mode

[](#performance-mode-1)

Redirects are only checked after Statamic determines a route doesn't exist. This prevents slowing down valid route hits.

```
return [
    'mode' => 'performance',
];
```

Or set via environment variable:

```
STATAMIC_DETOUR_MODE=performance
```

### Auto create

[](#auto-create)

Redirects are automatically created whenever an entry's slug is changed. If you change the slug of a parent, this change will also be reflected in its children.

```
return [
    'auto_create' => true,
];
```

Or set via environment variable:

```
STATAMIC_DETOUR_AUTO_CREATE=true
```

Usage
-----

[](#usage)

### Creating Redirects

[](#creating-redirects)

Navigate to **Tools &gt; Detours** in the Statamic Control Panel to manage your redirects.

#### Path Redirects

[](#path-redirects)

Create simple path-based redirects:

- **From**: `/old-page`
- **To**: `/new-page`
- **Type**: Path
- **Code**: 301 (or 302, 307, 308)
- **Sites**: Leave empty for global, or select specific sites

#### Regex Redirects

[](#regex-redirects)

Create powerful pattern-based redirects:

- **From**: `/blog/(\d{4})/(\d{2})/(.*)`
- **To**: `/articles/$1/$2/$3`
- **Type**: Regex
- **Code**: 301
- **Sites**: Select specific sites if needed

### Multi-Site Support

[](#multi-site-support)

When creating a redirect, you can:

- **Leave Sites empty**: The redirect will apply globally to all sites
- **Select specific sites**: The redirect will only apply to the selected site handles

This allows you to manage redirects per site in a multi-site Statamic installation.

### Storage Considerations

[](#storage-considerations)

#### File Driver

[](#file-driver)

- Redirects are stored as YAML files in `content/detours/`
- Each redirect is a separate file
- Perfect for version control
- Best for smaller sites (&lt; 100 redirects)

#### Eloquent Driver

[](#eloquent-driver-1)

- Redirects are stored in the `detours` database table
- Better performance for large numbers of redirects
- Recommended for sites with 100+ redirects
- Supports faster lookups and queries

Development
-----------

[](#development)

When developing this addon, you'll need to build the Control Panel assets. **Node.js 22+** is required for the build process:

```
cd /path/to/statamic-detour
npm install
npm run build
```

For hot reloading during development, run `npm run dev` in a separate terminal.

Quality
-------

[](#quality)

To ensure the quality of this package, run the following command:

```
composer quality
```

This will execute three tasks:

1. Makes sure all tests are passed
2. Checks for any issues using static code analysis
3. Checks if the code is correctly formatted

Credits
-------

[](#credits)

- [Bob Wezelman](https://github.com/BobWez98)
- [Niek Boon](https://github.com/niekboon)
- [All Contributors](../../contributors)

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

[ ![JustBetter logo](./art/footer.svg)](https://justbetter.nl "JustBetter")

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance88

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

4

Last Release

80d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d00b3f55cd4ae8b8cfb001a644ed6c7a1127a956c24375bcfe16ce12bd89bed?d=identicon)[justbetter](/maintainers/justbetter)

---

Top Contributors

[![BobWez98](https://avatars.githubusercontent.com/u/23509926?v=4)](https://github.com/BobWez98 "BobWez98 (37 commits)")[![niekboon](https://avatars.githubusercontent.com/u/81699906?v=4)](https://github.com/niekboon "niekboon (33 commits)")[![kevinmeijer97](https://avatars.githubusercontent.com/u/9716909?v=4)](https://github.com/kevinmeijer97 "kevinmeijer97 (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/justbetter-statamic-detour/health.svg)

```
[![Health](https://phpackages.com/badges/justbetter-statamic-detour/health.svg)](https://phpackages.com/packages/justbetter-statamic-detour)
```

###  Alternatives

[binaryk/laravel-restify

Laravel REST API helpers

651399.1k](/packages/binaryk-laravel-restify)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[lomkit/laravel-rest-api

A package to build quick and robust rest api for the Laravel framework.

59152.2k](/packages/lomkit-laravel-rest-api)[wirechat/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

5434.7k](/packages/wirechat-wirechat)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
