diff --git a/CHANGELOG.md b/CHANGELOG.md index 86cb40f0d..7bbe06906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Handle `errors.display` system property better in admin plugin [admin#1452](https://github.com/getgrav/grav-plugin-admin/issues/1452) * Fix classes on non-http based protocol links [#2034](https://github.com/getgrav/grav/issues/2034) * Fixed crash on IIS (Windows) with open_basedir in effect [#2053](https://github.com/getgrav/grav/issues/2053) + * Fixed incorrect routing with setup.php based base [#1892](https://github.com/getgrav/grav/issues/1892) # v1.4.5 ## 05/15/2018 diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 2995374d8..8017ecb88 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -150,11 +150,10 @@ class Uri $uri = str_replace(static::filterPath($this->root), '', $this->url); - // remove the setup.php based base if set: $setup_base = $grav['pages']->base(); if ($setup_base) { - $uri = str_replace($setup_base, '', $uri); + $uri = preg_replace('|^' . preg_quote($setup_base, '|') . '|', '', $uri); } // If configured to, redirect trailing slash URI's with a 302 redirect