Fix #137 - No Api redirect with empty base directory

This commit is contained in:
Matt Lorimer 2025-06-18 14:39:06 +01:00 committed by Matt Lorimer
parent ca6f9f12ab
commit 7d1d113403

View file

@ -100,7 +100,12 @@ class LegacyApiRedirectHandler extends LegacyRedirectHandler
$base = $_SERVER['BASE'] ?? $_SERVER['REDIRECT_BASE'] ?? '';
$scriptName = $base . '/legacy/' . $info['dir'] . '/' . $info['file'];
$requestUri = str_replace($base, $base . '/legacy', $_SERVER['REQUEST_URI']);
if (!empty($base)) {
$requestUri = str_replace($base, $base . '/legacy', $_SERVER['REQUEST_URI']);
} else {
$requestUri = '/legacy' . $_SERVER['REQUEST_URI'];
}
$info['script-name'] = $scriptName;
$info['request-uri'] = $requestUri;