From 811e2ffd1d6ec953154b380709460fb512782055 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sat, 7 Jan 2023 19:05:25 +0000 Subject: [PATCH] Preserve query string when redirecting. --- lib/index | 2 +- public/index.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/index b/lib/index index fbe4fe1..30064e6 160000 --- a/lib/index +++ b/lib/index @@ -1 +1 @@ -Subproject commit fbe4fe18decd502a0ca15ffe8a7c3b2d847349d5 +Subproject commit 30064e6891d3d06abe0174b921dc505ff74f4300 diff --git a/public/index.php b/public/index.php index 2d9d910..101f5ae 100644 --- a/public/index.php +++ b/public/index.php @@ -30,7 +30,13 @@ $router->get('/:id', function($response, $request, $id) use ($db) { if(!$info->next()) return 404; - $response->redirect($info->getString(0)); + $targetUrl = $info->getString(0); + + $params = $request->getParamString(); + if(!empty($params)) + $targetUrl .= '?' . $params; + + $response->redirect($targetUrl); }); $router->dispatch();