Fixed site redirect with redirect code failing when redirecting to sub-pages [#3035]

This commit is contained in:
Matias Griese
2021-03-11 18:39:18 +02:00
parent 6dd7044786
commit a67a538dfd
2 changed files with 3 additions and 2 deletions

View File

@@ -21,6 +21,7 @@
* Fixed Markdown image attribute `loading` [#3251](https://github.com/getgrav/grav/pull/3251)
* Fixed `Uri::isValidExtension()` returning false positives
* Fixed `page.html` returning duplicated content with `system.pages.redirect_default_route` turned on [#3130](https://github.com/getgrav/grav/issues/3130)
* Fixed site redirect with redirect code failing when redirecting to sub-pages [#3035](https://github.com/getgrav/grav/pull/3035/files)
# v1.7.7
## 02/23/2021

View File

@@ -431,8 +431,8 @@ class Grav extends Container
}
if (null === $code) {
// Check for code in route
$regex = '/.*(\[(30[1-7])\])$/';
// Check for redirect code in the route: e.g. /new/[301], /new[301]/route or /new[301].html
$regex = '/.*(\[(30[1-7])\])(.\w+|\/.*?)?$/';
preg_match($regex, $route, $matches);
if ($matches) {
$route = str_replace($matches[1], '', $matches[0]);