diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 593ccd53a63..fd5deb31c36 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -698,10 +698,12 @@ abstract class CommonObject } else return ''; } - // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + // This is to use external domain name found into config file + //if (DOL_URL_ROOT && ! preg_match('/\/$/', $urlwithouturlroot) && ! preg_match('/^\//', DOL_URL_ROOT)) $urlwithroot=$urlwithouturlroot.'/'.DOL_URL_ROOT; + //else + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $forcedownload=0;