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