mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 19:06:16 +01:00
Fixed redirect when using full path on subfolder install
This commit is contained in:
@@ -363,11 +363,15 @@ class Admin
|
||||
return;
|
||||
}
|
||||
|
||||
$redirect = '/' . ltrim($redirect, '/');
|
||||
$redirect = '/' . ltrim(preg_replace('`//+`', '/', $redirect), '/');
|
||||
$base = $this->base;
|
||||
$root = Grav::instance()['uri']->rootUrl();
|
||||
if ($root === '/') {
|
||||
$root = '';
|
||||
}
|
||||
|
||||
// Check if we already have an admin path: /admin.
|
||||
if (Utils::startsWith($redirect, $base)) {
|
||||
// Check if we already have an admin path: /admin or /root/admin.
|
||||
if (Utils::startsWith($redirect, $base, false) || Utils::startsWith($redirect, $root . $base, false)) {
|
||||
$this->grav->redirect($redirect, $redirectCode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user