From cecee258bb325b8e42413a2c0bdde07d2889c73e Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 13 Jun 2013 18:41:32 +0000 Subject: nicer urls when used over https git-svn-id: http://piwigo.org/svn/trunk@23187 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_url.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/functions_url.inc.php') diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index 787c06780..56ea858e1 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -51,9 +51,11 @@ function get_absolute_root_url($with_scheme=true) $url = ''; if ($with_scheme) { + $is_https = false; if (isset($_SERVER['HTTPS']) && - ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1))) + ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1))) { + $is_https = true; $url .= 'https://'; } else @@ -61,7 +63,8 @@ function get_absolute_root_url($with_scheme=true) $url .= 'http://'; } $url .= $_SERVER['HTTP_HOST']; - if ($_SERVER['SERVER_PORT'] != 80) + if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80) + ||($is_https && $_SERVER['SERVER_PORT'] != 443)) { $url_port = ':'.$_SERVER['SERVER_PORT']; if (strrchr($url, ':') != $url_port) -- cgit v1.2.3