diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2dc5b5..2438d3bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ 1. [](#improved) * Table CSS improvements for use in 3rd party plugins +1. [](#bugfix) + * Fix redirect bug when changing admin route to `admin-*` # v1.7.1 ## 03/11/2018 diff --git a/admin.php b/admin.php index 5c86bc2f..092eba60 100644 --- a/admin.php +++ b/admin.php @@ -779,7 +779,7 @@ class AdminPlugin extends Plugin // Special case to redirect after changing the admin route to avoid 'breaking' $obj = $event['object']; if (isset($obj->route) && $this->admin_route !== $obj->route) { - $redirect = str_replace($this->admin_route, $obj->route, $this->uri->path() ); + $redirect = preg_replace('/^' . str_replace('/','\/',$this->admin_route) . '/',$obj->route,$this->uri->path()); $this->grav->redirect($redirect); } }