feat: add editable 301 redirects via dedicated panel page
All checks were successful
Deploy Production / Deploy to Production (push) Successful in 21s

- New "Redirections" page in panel (blueprint + content) with a structure
  field: old URL (text) → target page (pages field, auto-resolves URL)
- error.php controller intercepts 404s, checks redirect map, fires go() 301
- Cache (file driver) invalidated on redirections page update or slug change
- Removed catch-all route that was breaking Kirby multilingual routing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-06-01 09:47:59 +02:00
parent 91ac702f3c
commit dbeca5e095
5 changed files with 81 additions and 3 deletions

View file

@ -12,8 +12,23 @@ return [
'thumbs' => require __DIR__ . '/thumbs.php',
'cache' => [
'redirects' => ['type' => 'file'],
],
'hooks' => [
'page.update:after' => function ($newPage) {
if ($newPage->id() === 'redirections') {
kirby()->cache('redirects')->remove('map');
}
},
'page.changeSlug:after' => function () {
kirby()->cache('redirects')->remove('map');
},
],
'routes' => [
require(__DIR__ . '/routes/download-white-paper.php')
require(__DIR__ . '/routes/download-white-paper.php'),
],
'tobimori.seo' => [