diff --git a/public/index.php b/public/index.php index 86df1ce..8947cc0 100644 --- a/public/index.php +++ b/public/index.php @@ -13,10 +13,13 @@ // Register the Composer autoloader... require __DIR__.'/../vendor/autoload.php'; -// Strato: the domain points at the deployment folder and .htaccess forwards to releases//public. -// The script then lives below that path, so the base URL would contain it and signed links would not -// match. The site is always served from the domain root, therefore the script is reported as /index.php. -if (preg_match('~/(releases/[^/]+|current)/public/index\.php$~', $_SERVER['SCRIPT_NAME'] ?? '')) { +// Strato: the domain points at the deployment folder and .htaccess forwards to releases//public, +// and the web server then reports the rewritten path in REQUEST_URI/SCRIPT_NAME. Laravel would see +// "/releases/…/public/angebot/2" instead of "/angebot/2" (signed links would fail). The site is always +// served from the domain root, so the internal prefix is removed here. +if (preg_match('~^/(?:releases/[^/?]+|current)/public(?=[/?]|$)~', $_SERVER['REQUEST_URI'] ?? '', $internalPrefix)) { + $path = substr($_SERVER['REQUEST_URI'], strlen($internalPrefix[0])); + $_SERVER['REQUEST_URI'] = str_starts_with($path, '/') ? $path : '/'.$path; $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = '/index.php'; }