Redirection Laravel Package
Installation
You can install the package via composer:
composer require combindma/redirector
The package will automatically register itself.
Next you must register the Combindma\Redirector\RedirectsMissingPages
-middleware:
//app/Http/Kernel.php
protected $middleware = [
...
\Combindma\Redirector\RedirectsMissingPages::class,
],
You must publish and run the migrations with:
php artisan vendor:publish --provider="Combindma\Redirector\RedirectorServiceProvider" --tag="redirector-migrations"
php artisan migrate
You must publish the config file with:
php artisan vendor:publish --provider="Combindma\Redirector\RedirectorServiceProvider" --tag="redirector-config"
This is the contents of the published config file:
return [
/*
* This is the class responsible for providing the URLs which must be redirected.
* The only requirement for the redirector is that it needs to implement the
* `Spatie\MissingPageRedirector\Redirector\Redirector`-interface
*/
'redirector' => \Combindma\Redirector\UrlsRedirector::class,
/*
* By default the package will only redirect 404s. If you want to redirect on other
* response codes, just add them to the array. Leave the array empty to redirect
* always no matter what the response code.
*/
'redirect_status_codes' => [
\Symfony\Component\HttpFoundation\Response::HTTP_NOT_FOUND,
],
/*
* When using the `ConfigurationRedirector` you can specify the redirects in this array.
* You can use Laravel's route parameters here.
*/
'redirects' => [
// '/non-existing-page' => '/existing-page',
// '/old-blog/{url}' => '/new-blog/{url}',
],
];
Usage
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.