diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/locale.inc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/includes/locale.inc b/includes/locale.inc index 7fb8d6424..fde19dd55 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -279,6 +279,12 @@ function locale_language_from_url($languages) { break; case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN: + // Get only the host, not the port. + $http_host= $_SERVER['HTTP_HOST']; + if (strpos($http_host, ':') !== FALSE) { + $http_host_tmp = explode(':', $http_host); + $http_host = current($http_host_tmp); + } foreach ($languages as $language) { // Skip check if the language doesn't have a domain. if ($language->domain) { @@ -286,7 +292,7 @@ function locale_language_from_url($languages) { // Remove protocol and add http:// so parse_url works $host = 'http://' . str_replace(array('http://', 'https://'), '', $language->domain); $host = parse_url($host, PHP_URL_HOST); - if ($_SERVER['HTTP_HOST'] == $host) { + if ($http_host == $host) { $language_url = $language->language; break; } |