1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 00:20:08 +01:00

Only serve recognized locales if the file exists.

This commit is contained in:
Jason Varga
2017-08-24 14:42:40 -04:00
parent db5f5d80e9
commit d12eb0e140

View File

@@ -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;