From 29bfeabcee1b4c52adaa8d768e56ba3a3604969a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Sun, 20 Mar 2011 19:52:50 +0000 Subject: [PATCH] Fix: Alt url --- htdocs/filefunc.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 5fe7a04224f..d70e1fcb606 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -137,7 +137,7 @@ foreach($paths as $path) break; } } -if (! $found) // If autodetect fails (Ie: when uing apache alias that point outside default DOCUMENT_ROOT. +if (! $found) // If autodetect fails (Ie: when uing apache alias that point outside default DOCUMENT_ROOT. { $tmp=$dolibarr_main_url_root; } @@ -153,7 +153,8 @@ define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr' // Define DOL_MAIN_URL_ROOT_ALT and DOL_URL_ROOT_ALT if (! empty($dolibarr_main_url_root_alt)) { - $tmp_alt=$tmp.str_replace($dolibarr_main_url_root,'',$dolibarr_main_url_root_alt); + $altpart=str_replace($dolibarr_main_url_root,'',$dolibarr_main_url_root_alt); + $tmp_alt=$tmp.(preg_match('/^\//',$altpart)?'':'/').$altpart; define('DOL_MAIN_URL_ROOT_ALT', $tmp_alt); // URL absolute root (https://sss/dolibarr/custom, ...) $uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT_ALT')); // $uri contains url without http* $suburi = strstr($uri, '/'); // $suburi contains url without domain -- GitLab