mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 00:20:08 +01:00
Handle localized sites within a public directory
This commit is contained in:
@@ -62,22 +62,24 @@ public function frontControllerPath($sitePath, $siteName, $uri)
|
||||
$indexPath = $sitePath.'/index.php';
|
||||
}
|
||||
|
||||
if ($this->isActualFile($sitePath.'/public/index.php')) {
|
||||
if ($isAboveWebroot = $this->isActualFile($sitePath.'/public/index.php')) {
|
||||
$indexPath = $sitePath.'/public/index.php';
|
||||
}
|
||||
|
||||
$sitePathPrefix = ($isAboveWebroot) ? $sitePath.'/public' : $sitePath;
|
||||
|
||||
if ($locale = $this->getUriLocale($uri)) {
|
||||
// Force trailing slashes on locale roots.
|
||||
if ($uri === '/' . $locale) {
|
||||
header('Location: ' . $uri . '/'); die;
|
||||
}
|
||||
|
||||
$indexPath = $sitePath . '/' . $locale . '/index.php';
|
||||
$indexPath = $sitePathPrefix . '/' . $locale . '/index.php';
|
||||
$scriptName = '/' . $locale . '/index.php';
|
||||
}
|
||||
|
||||
$_SERVER['SCRIPT_NAME'] = $scriptName;
|
||||
$_SERVER['SCRIPT_FILENAME'] = $sitePath . $scriptName;
|
||||
$_SERVER['SCRIPT_FILENAME'] = $sitePathPrefix . $scriptName;
|
||||
|
||||
return $indexPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user