1. Go to this page and download the library: Download bnomei/kirby3-redirects 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/ */
bnomei / kirby3-redirects example snippets
return [
'hooks' => [
'redirect:before' => function (int $code, \Bnomei\Redirect $redirect) {
// do whatever you need, like...
monolog('redirect')->info($code, [
'from' => $redirect->from(),
'to' => $redirect->to()
]);
},
'404:before' => function (\Kirby\Http\Route $route, string $path, string $method) {
// do whatever you need, like...
F::write(kirby()->root('logs').'/404.log', implode(' ', [
'['.date('Y-m-d H:i:s').']',
'404.ERROR',
$method,
$path,
PHP_EOL,
]), true);
},
],
// other config...
];