yotech-ai / twill-cms-redirects
A Twill CMS package
Requires
- area17/twill: ^3.4
- dev-main
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.1
- dev-codex/fix-redirectmiddleware-not-working
- dev-gitignore
- dev-codex/ensure-redirectmiddleware-supports-this-redirect
- dev-update-readme
- dev-codex/update-readme-and-redirectmiddleware-fallback
- dev-codex/update-readme-for-middleware-placement
- dev-routes
- dev-fix-bug
- dev-codex/fix-duplicate-redirect-links-and-missing-seeder
- dev-codex/fix-redirectcontroller-modulename-definition
- dev-remove-version-composer
- dev-0sh2yr-codex/convert-repository-to-composer-package
- dev-codex/convert-repository-to-composer-package
- dev-codex/generate-twill-capsule-with-redirects-and-middleware
This package is auto-updated.
Last update: 2025-07-19 08:41:44 UTC
README
This package provides a simple redirect management capsule for Twill. It registers a singleton module where you can configure redirect rules that are applied by middleware on every request.
Installation
composer require yotech-ai/twill-cms-redirects
Migration
Publish and run the package migration:
php artisan vendor:publish --tag="twill-cms-redirects-migrations"
php artisan migrate
Usage
The capsule creates a singleton module called redirects
. Administrators can define redirect rules through the Twill UI. Each rule contains a from
URL, a to
URL and the status code to use.
Requests are intercepted by twill.redirects
middleware which performs the redirect if a rule matches.
Activation
Add the service provider and middleware alias to your config/twill.php
if not automatically discovered:
'providers' => [ // ... TwillRedirects\TwillRedirectsServiceProvider::class, ],
Laravel 11 no longer uses the Http\Kernel
class for middleware
registration. Instead, middleware is configured in bootstrap/app.php
.
Because redirect rules may apply to URLs that don't match any defined
route, the middleware should run before route resolution. Prepend it to
the global middleware stack within the withMiddleware
closure:
use TwillRedirects\Http\Middleware\RedirectMiddleware; use Illuminate\Foundation\Configuration\Middleware; ->withMiddleware(function (Middleware $middleware) { $middleware->prepend(RedirectMiddleware::class); })
Seeder
A RedirectSeeder
is included and will create the initial singleton record if none exists. Twill automatically runs this seeder when you visit the capsule for the first time.
License
MIT