mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 06:34:17 +00:00
Fix Canonical-URL when deployed in a Folder
This commit is contained in:
parent
7d0d4db2e4
commit
9f9fe26bdd
3 changed files with 12 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
$route = @$_GET['route'];
|
||||
$route = rtrim($route, '/');
|
||||
$GLOBALS['ROUTE'] = $route;
|
||||
|
||||
require_once('config.php');
|
||||
require_once('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);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<base href="<?=h($baseurl)?>" />
|
||||
<link href="<?=h($baseurl.ltrim($_SERVER['REQUEST_URI'], '/'))?>" rel="canonical" />
|
||||
<link href="<?=h($baseurl.forceslash($GLOBALS['ROUTE']))?>" rel="canonical" />
|
||||
|
||||
<link href="assets/img/apple-touch-icon/76x76.png" rel="apple-touch-icon" />
|
||||
<link href="assets/img/apple-touch-icon/76x76.png" rel="apple-touch-icon" sizes="76x76" />
|
||||
|
|
Loading…
Reference in a new issue