return [
/*
* This is the class responsible for providing the URLs which must be redirected.
* The only Redirector\Redirector\ConfigurationRedirector::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}',
],
];
namespace Spatie\MissingPageRedirector\Redirector;
use Symfony\Component\HttpFoundation\Request;
interface Redirector
{
public function getRedirectsFor(Request $request): array;
}
use Spatie\MissingPageRedirector\MissingPageRouter;
//... Your other route
Route::fallback(function (Request $request) {
$redirectResponse = app(MissingPageRouter::class)->getRedirectFor($request);
if ($redirectResponse !== null) {
return $redirectResponse;
}
//... Your other logic
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.