From 7782eefa968b5e6675589ec8cf00c7da78dea815 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 17 Jan 2026 00:03:53 +0100 Subject: [PATCH] Add trailing slash redirect for list routes --- app/router.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/router.php b/app/router.php index ceaa25c..c4e61dd 100644 --- a/app/router.php +++ b/app/router.php @@ -82,6 +82,12 @@ switch ($parsedPath['type']) { case 'list': $dir = $parsedPath['path']; + // Redirect to add trailing slash if needed + if (!$ctx->hasTrailingSlash) { + header('Location: ' . rtrim($_SERVER['REQUEST_URI'], '/') . '/', true, 301); + exit; + } + // Check for page content files in this directory $pageContent = null; $contentFiles = findAllContentFiles($dir);