mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 16:40:05 +01:00
Only serve recognized locales if the file exists.
This commit is contained in:
@@ -69,14 +69,17 @@ public function frontControllerPath($sitePath, $siteName, $uri)
|
|||||||
$sitePathPrefix = ($isAboveWebroot) ? $sitePath.'/public' : $sitePath;
|
$sitePathPrefix = ($isAboveWebroot) ? $sitePath.'/public' : $sitePath;
|
||||||
|
|
||||||
if ($locale = $this->getUriLocale($uri)) {
|
if ($locale = $this->getUriLocale($uri)) {
|
||||||
|
if ($this->isActualFile($localeIndexPath = $sitePathPrefix . '/' . $locale . '/index.php')) {
|
||||||
// Force trailing slashes on locale roots.
|
// Force trailing slashes on locale roots.
|
||||||
if ($uri === '/' . $locale) {
|
if ($uri === '/' . $locale) {
|
||||||
header('Location: ' . $uri . '/'); die;
|
header('Location: ' . $uri . '/');
|
||||||
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
$indexPath = $sitePathPrefix . '/' . $locale . '/index.php';
|
$indexPath = $localeIndexPath;
|
||||||
$scriptName = '/' . $locale . '/index.php';
|
$scriptName = '/' . $locale . '/index.php';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$_SERVER['SCRIPT_NAME'] = $scriptName;
|
$_SERVER['SCRIPT_NAME'] = $scriptName;
|
||||||
$_SERVER['SCRIPT_FILENAME'] = $sitePathPrefix . $scriptName;
|
$_SERVER['SCRIPT_FILENAME'] = $sitePathPrefix . $scriptName;
|
||||||
|
|||||||
Reference in New Issue
Block a user