From 9f9fe26bdde914ea5d090755b30c39fc1d6a468a Mon Sep 17 00:00:00 2001
From: MaZderMind
Date: Tue, 3 Mar 2015 11:20:45 +0100
Subject: Fix Canonical-URL when deployed in a Folder
---
index.php | 1 +
lib/helper.php | 11 ++++++++++-
template/page.phtml | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/index.php b/index.php
index 07bac59..e4b4417 100644
--- a/index.php
+++ b/index.php
@@ -2,6 +2,7 @@
$route = @$_GET['route'];
$route = rtrim($route, '/');
+$GLOBALS['ROUTE'] = $route;
require_once('config.php');
require_once('lib/helper.php');
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);
diff --git a/template/page.phtml b/template/page.phtml
index 498036a..9af5d7b 100644
--- a/template/page.phtml
+++ b/template/page.phtml
@@ -27,7 +27,7 @@
-
+
--
cgit v1.2.3