From 63e5dd76d989c97f944c1cf0650f659bc5a40140 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Mon, 11 Mar 2013 18:44:45 +0100 Subject: #2049 - Fix issues with ports other than http/80 or https/443. - get SERVER_PORT and add to SERVER_NAME if it's not http/80 or https/443 --- system/helpers/url.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/url.php b/system/helpers/url.php index 014f96fe..02956fc3 100644 --- a/system/helpers/url.php +++ b/system/helpers/url.php @@ -62,7 +62,9 @@ class url_Core { if ($site_domain === '' OR $site_domain[0] === '/') { // Guess the server name if the domain starts with slash - $base_url = $protocol.'://'.($_SERVER['SERVER_NAME']?$_SERVER['SERVER_NAME']:$_SERVER['HTTP_HOST']).$site_domain; + $port = $_SERVER['SERVER_PORT']; + $port = ((($port == 80) && ($protocol == 'http')) || (($port == 443) && ($protocol == 'https')) || !$port) ? '' : ":$port"; + $base_url = $protocol.'://'.($_SERVER['SERVER_NAME']?($_SERVER['SERVER_NAME'].$port):$_SERVER['HTTP_HOST']).$site_domain; } else { -- cgit v1.2.3