diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 070807ba5..1763ad309 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -79,11 +79,6 @@ class Uri $config = $grav['config']; $language = $grav['language']; - // If configured to, redirect trailing slash URI's with a 301 redirect - if ($config->get('system.pages.redirect_trailing_slash', false) && $this->url != '/' && Utils::endsWith($this->url, '/')) { - $grav->redirect(rtrim($this->url, '/'), 301); - } - // resets $this->paths = []; $this->params = []; @@ -93,6 +88,11 @@ class Uri // get any params and remove them $uri = str_replace($this->root, '', $this->url); + // If configured to, redirect trailing slash URI's with a 301 redirect + if ($config->get('system.pages.redirect_trailing_slash', false) && $uri != '/' && Utils::endsWith($uri, '/')) { + $grav->redirect(rtrim($uri, '/'), 301); + } + // process params $uri = $this->processParams($uri, $config->get('system.param_sep'));