aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaZderMind2015-03-03 11:20:45 +0100
committerMaZderMind2015-03-03 11:20:45 +0100
commit9f9fe26bdde914ea5d090755b30c39fc1d6a468a (patch)
tree80fa4e61a458d186b96718dc010b6896d87e91a9 /lib
parent7d0d4db2e41b1850cb1005c0a0bfde8967d4c3b2 (diff)
Fix Canonical-URL when deployed in a Folder
Diffstat (limited to 'lib')
-rw-r--r--lib/helper.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 4beef4d..91583d1 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -86,11 +86,20 @@ function baseurl()
$base = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) ? 'https://' : 'http://';
$base .= $_SERVER['HTTP_HOST'];
- $base .= rtrim(dirname($_SERVER['SCRIPT_NAME']), '/').'/';
+ $base .= forceslash(dirname($_SERVER['SCRIPT_NAME']));
return $base;
}
+function forceslash($url)
+{
+ $url = rtrim($url, '/');
+ if(strlen($url) > 0)
+ $url .= '/';
+
+ return $url;
+}
+
function strtoduration($str)
{
$parts = explode(':', $str);