Laravel Seo Rewrite
, (*1)
Introduction
With this package we want to give you a simple way to manage your SEO rewrites in your Laravel application. Rewrites are created and deleted
by dispatching events in your code., (*2)
Installation
You can install the package via composer., (*3)
composer require black-bits/laravel-seo-rewrite
Next you need to run our migrations., (*4)
php artisan migrate
When you install the package our LaravelSeoRewrites Middleware is automatically pushed to the global MiddlewareGroup and activated., (*5)
Usage
To create a new redirect, simply create a new SeoRewrite entry.
- The source value must be a relative path matching one of your routes.
- The destination can be any relative or absolute URL.
- The type must be a valid redirect type (permanent, temporary, etc.), (*6)
SeoRewrite::create([
'source' => '/old-route',
'destination' => '/new-route',
'type' => 301
]);
SeoRewrite::create([
'source' => '/old-route',
'destination' => 'https://your-new.domain/old-route',
'type' => 308
]);
We run a basic redirect loop detection on model save, but not all cases can be detected.
Please be aware that you can potentially create loops., (*7)
Changelog
Please see CHANGELOG for more information on what has changed recently., (*8)
Security
If you discover any security related issues, please email hello@blackbits.io instead of using the issue tracker., (*9)
Credits
Support us
Black Bits, Inc. is a web and consulting agency specialized in Laravel and AWS based in Grants Pass, Oregon. You'll find an overview of what we do on our website., (*10)
License
The MIT License (MIT). Please see License File for more information., (*11)