diff --git a/metager/app/Http/Controllers/LangSelector.php b/metager/app/Http/Controllers/LangSelector.php index 7c80d58e166a3a5e929e10dd066c6ce93ef99e60..42d3f4eae9b00e998d466164392f314b73177ee4 100644 --- a/metager/app/Http/Controllers/LangSelector.php +++ b/metager/app/Http/Controllers/LangSelector.php @@ -27,6 +27,9 @@ class LangSelector extends Controller $path = isset($components["path"]) ? $components["path"] : "/"; $path .= isset($components["query"]) ? "?" . $components["query"] : ""; $path = preg_replace("/^\/[a-z]{2}-[A-Z]{2}/", "", $path); + if (empty($path)) { + $path = "/"; + } if (($host === $current_host || in_array($current_host, $allowed_hosts)) && preg_match("/^http(s)?:\/\//", $previous)) { // only if the host of that URL matches the current host $previous_url = LaravelLocalization::getLocalizedUrl(null, $path); }