PHP code example of snicco / redirect-middleware
1. Go to this page and download the library: Download snicco/redirect-middleware library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
snicco / redirect-middleware example snippets
// In your configuration for your PSR-11 container
use Snicco\Middleware\Redirect\Redirect;
$redirects = [
307 => [
'/foo' => '/bar'
],
301 => [
'/baz' => 'biz?boom=bang'
'/boom' => 'https://external-page.com'
]
];
// You can also load the redirects from a file.
$redirect = new Redirect($redirects);