Fix double slash in URL, closes #50

This commit is contained in:
Bartek Fabiszewski 2018-01-30 13:50:40 +01:00
parent f1bc4b137f
commit 153a174930
2 changed files with 7 additions and 1 deletions

View File

@ -177,7 +177,8 @@
* @return void
*/
public function exitWithRedirect($path = "") {
header("Location: " . BASE_URL . $path);
$location = str_replace("//", "/", BASE_URL . $path);
header("Location: $location");
exit();
}
}

View File

@ -108,6 +108,11 @@
exit;
}
/**
* Calculate app base URL
*
* @return string URL
*/
public static function getBaseUrl() {
$proto = (!isset($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] == "" || $_SERVER["HTTPS"] == "off") ? "http://" : "https://";
$host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : "";