diff --git a/htdocs/adherents/public.php b/htdocs/adherents/public.php
index cac2b2546c2..46d18c37c23 100644
--- a/htdocs/adherents/public.php
+++ b/htdocs/adherents/public.php
@@ -47,11 +47,9 @@ print ' ';
print '
';
diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php
index 9cf27df3c18..640f55ffcd3 100644
--- a/htdocs/admin/agenda_xcal.php
+++ b/htdocs/admin/agenda_xcal.php
@@ -129,14 +129,13 @@ print " ";
// Show message
$message='';
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
-$urlvcal=''.$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').' ';
+$urlvcal=''.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').' ';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
$message.=' ';
-$urlical=''.$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').' ';
+$urlical=''.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').' ';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'ical/ics',$urlical);
$message.=' ';
-$urlrss=''.$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').' ';
+$urlrss=''.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').' ';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'rss',$urlrss);
$message.=' ';
$message.=' ';
diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php
index 7db835a9723..a505843fcd8 100644
--- a/htdocs/admin/system/constall.php
+++ b/htdocs/admin/system/constall.php
@@ -133,6 +133,8 @@ foreach($configfileparameters as $key)
// Value
print "";
if ($key == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$key});
+ else if ($key == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$key})) print ${$key}.' => '.constant('DOL_MAIN_URL_ROOT');
+ else if ($key == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$key})) print ${$key}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
else print ${$key};
print " ";
}
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 554f5496775..f964c0785dc 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -754,9 +754,8 @@ class ActionComm extends CommonObject
$event['location']=$langs->convToOutputCharset($obj->location);
$event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy)
$event['category']=$langs->convToOutputCharset($obj->libelle); // libelle type action
- $url=$dolibarr_main_url_root;
- if (! preg_match('/\/$/',$url)) $url.='/';
- $url.='comm/action/fiche.php?id='.$obj->id;
+ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
+ $url=$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id;
$event['url']=$url;
$event['created']=$this->db->jdate($obj->datec);
$event['modified']=$this->db->jdate($obj->datem);
diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php
index aa1d1fc72f9..0e8f426a4a8 100755
--- a/htdocs/filefunc.inc.php
+++ b/htdocs/filefunc.inc.php
@@ -118,24 +118,44 @@ if (! empty($dolibarr_main_document_root_alt))
{
define('DOL_DOCUMENT_ROOT_ALT', $dolibarr_main_document_root_alt); // Filesystem paths to alternate core php (alternate htdocs)
}
-// If dolibarr_main_url_root = auto (Hidden feature for developers only), we try to forge it.
-if ($dolibarr_main_url_root == 'auto' && ! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"]))
+// Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT
+$tmp=$dolibarr_main_url_root;
+if (1 == 1) // Use auto forge url.
{
- $dolibarr_main_url_root=str_replace($_SERVER["SCRIPT_URL"],'',$_SERVER["SCRIPT_URI"]);
+ if (! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"]))
+ {
+ $tmp=str_replace($_SERVER["SCRIPT_URL"],'',$_SERVER["SCRIPT_URI"]);
+ }
+ else
+ {
+ //print realpath($dolibarr_main_document_root).'-'.realpath($_SERVER["DOCUMENT_ROOT"]).' ';
+ //print $dolibarr_main_document_root.'-'.$_SERVER["DOCUMENT_ROOT"].' ';
+ $tmp1=realpath($dolibarr_main_document_root);
+ $tmp2=realpath($_SERVER["DOCUMENT_ROOT"]);
+ $pos=strpos($tmp1,$tmp2);
+ if ($pos !== false && $pos == 0) $tmp3=str_replace($tmp2,'',$tmp1);
+ else $tmp3=str_replace($_SERVER["DOCUMENT_ROOT"],'',$dolibarr_main_document_root);
+ $tmp='http'.((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on')?'':'s').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]==80)?'':':'.$_SERVER["SERVER_PORT"]).($tmp3?(preg_match('/^\//',$tmp3)?'':'/').$tmp3:'');
+ //print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp;
+ }
}
-define('DOL_MAIN_URL_ROOT', $dolibarr_main_url_root); // URL absolute root
+if (! empty($dolibarr_main_force_https)) $tmp=preg_replace('/^http:/i','https:',$tmp);
+define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...)
$uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
-$suburi = strstr($uri, '/'); // $suburi contains url without domain
-if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
-define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
+$suburi = strstr($uri, '/'); // $suburi contains url without domain
+if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
+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))
{
- define('DOL_MAIN_URL_ROOT_ALT', $dolibarr_main_url_root_alt); // URL absolute root
+ $tmp_alt=$tmp.str_replace($dolibarr_main_url_root,'',$dolibarr_main_url_root_alt);
+ 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
- if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
- define('DOL_URL_ROOT_ALT', $suburi); // URL relative root ('', '/dolibarr', ...)
+ $suburi = strstr($uri, '/'); // $suburi contains url without domain
+ if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
+ define('DOL_URL_ROOT_ALT', $suburi); // URL relative root ('', '/dolibarr/custom', ...)
}
+// Define DOL_URL_ROOT_FULL_STATIC
if (! empty($dolibarr_main_url_root_static)) define('DOL_URL_ROOT_FULL_STATIC', $dolibarr_main_url_root_static); // Used to put static images on another domain
// Define prefix
if (isset($_SERVER["LLX_DBNAME"])) $dolibarr_main_db_prefix=$_SERVER["LLX_DBNAME"];
diff --git a/htdocs/lib/xcal.lib.php b/htdocs/lib/xcal.lib.php
index 01158e71aa1..b6acf02a1f4 100644
--- a/htdocs/lib/xcal.lib.php
+++ b/htdocs/lib/xcal.lib.php
@@ -317,9 +317,8 @@ function build_rssfile($format='rss',$title,$desc,$events_array,$outputfile,$fil
''.$date.' '."\n".
'Dolibarr '."\n";
- $url=$dolibarr_main_url_root;
- if (! preg_match('/\/$/',$url)) $url.='/';
- $url.='public/agenda/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
+ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
+ $url=$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
$html.=' '."\n";
// 'editor@example.com '."\n"
// 'webmaster@example.com '."\n"
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 2fab52d82b3..280257f608f 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -184,9 +184,7 @@ if (! empty($conf->file->main_force_https))
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') // If link is http
{
- $uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root);
- $val=explode('/',$uri); // $val[0] contains domain name and port
- $newurl='https://'.$val[0].$_SERVER["REQUEST_URI"];
+ $newurl=preg_replace('/^http:/i','https:',DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
}
}
}
diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php
index aa358d54ce9..a9a2780923a 100644
--- a/htdocs/paybox/admin/paybox.php
+++ b/htdocs/paybox/admin/paybox.php
@@ -183,30 +183,28 @@ print '';
print ' ';
print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").': ';
-// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).': ';
-print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=9.99 &tag=your_free_tag '." \n";
+print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?amount=9.99 &tag=your_free_tag '." \n";
if ($conf->commande->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/newpayment.php?source=order&ref=order_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=order&ref=order_ref '." \n";
}
if ($conf->facture->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/newpayment.php?source=invoice&ref=invoice_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=invoice&ref=invoice_ref '." \n";
// print $langs->trans("SetupPayBoxToHavePaymentCreatedAutomatically",$langs->transnoentitiesnoconv("FeatureNotYetAvailable"))." \n";
}
if ($conf->contrat->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/newpayment.php?source=contractline&ref=contractline_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=contractline&ref=contractline_ref '." \n";
}
if ($conf->adherent->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/newpayment.php?source=membersubscription&ref=member_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=membersubscription&ref=member_ref '." \n";
}
print " ";
diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php
index 3ea415486b3..e10a58ad9ad 100644
--- a/htdocs/paypal/admin/paypal.php
+++ b/htdocs/paypal/admin/paypal.php
@@ -208,30 +208,28 @@ print ' ';
// Url list
print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").': ';
-// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).': ';
-print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?amount=9.99 &tag=your_free_tag '." \n";
+print ''.DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount=9.99 &tag=your_free_tag '." \n";
if ($conf->commande->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?source=order&ref=order_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=order&ref=order_ref '." \n";
}
if ($conf->facture->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?source=invoice&ref=invoice_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=invoice&ref=invoice_ref '." \n";
// print $langs->trans("SetupPaypalToHavePaymentCreatedAutomatically",$langs->transnoentitiesnoconv("FeatureNotYetAvailable"))." \n";
}
if ($conf->contrat->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?source=contractline&ref=contractline_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=contractline&ref=contractline_ref '." \n";
}
if ($conf->adherent->enabled)
{
print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).': ';
- print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref=member_ref '." \n";
+ print ''.DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref=member_ref '." \n";
}
print " ";
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 8e3ba6d6a48..3c9b91e3f31 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1339,7 +1339,7 @@ class User extends CommonObject
}
// Define urlwithouturlroot
- if (1 == 1 && ! empty($_SERVER["HTTP_HOST"])) // Autodetect main url root
+ if (! empty($_SERVER["HTTP_HOST"])) // Autodetect main url root
{
$urlwithouturlroot='http://'.preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$_SERVER["HTTP_HOST"]);
}
diff --git a/htdocs/webservices/admin/webservices.php b/htdocs/webservices/admin/webservices.php
index 5222476cafb..76387001dfe 100644
--- a/htdocs/webservices/admin/webservices.php
+++ b/htdocs/webservices/admin/webservices.php
@@ -99,21 +99,19 @@ if ($mesg) print ' '.$mesg;
print ' ';
-// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
// WSDL
print ''.$langs->trans("WSDLCanBeDownloadedHere").': ';
-$url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_other.php?wsdl';
+$url=DOL_MAIN_URL_ROOT.'/webservices/server_other.php?wsdl';
print img_picto('','object_globe.png').' '.''.$url." \n";
if ($conf->societe->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_thirdparty.php?wsdl';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php?wsdl';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
if ($conf->facture->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_invoice.php?wsdl';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php?wsdl';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
print ' ';
@@ -121,16 +119,16 @@ print ' ';
// Endpoint
print ''.$langs->trans("EndPointIs").': ';
-$url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_other.php';
+$url=DOL_MAIN_URL_ROOT.'/webservices/server_other.php';
print img_picto('','object_globe.png').' '.''.$url." \n";
if ($conf->societe->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_thirdparty.php';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
if ($conf->facture->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_invoice.php';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
print ' ';
diff --git a/htdocs/webservices/demo_wsclient_invoice.php b/htdocs/webservices/demo_wsclient_invoice.php
index f740e3709f7..d9400563525 100755
--- a/htdocs/webservices/demo_wsclient_invoice.php
+++ b/htdocs/webservices/demo_wsclient_invoice.php
@@ -28,7 +28,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
-$WS_DOL_URL = $dolibarr_main_url_root.'/webservices/server_invoice.php';
+$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
$WS_METHOD1 = 'getInvoice';
$WS_METHOD2 = 'getInvoicesForThirdParty';
diff --git a/htdocs/webservices/demo_wsclient_other.php b/htdocs/webservices/demo_wsclient_other.php
index 0c08265eb62..36a98501bfc 100755
--- a/htdocs/webservices/demo_wsclient_other.php
+++ b/htdocs/webservices/demo_wsclient_other.php
@@ -28,7 +28,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
-$WS_DOL_URL = $dolibarr_main_url_root.'/webservices/server_other.php';
+$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php';
$WS_METHOD = 'getVersions';
diff --git a/htdocs/webservices/demo_wsclient_thirdparty.php b/htdocs/webservices/demo_wsclient_thirdparty.php
index b3a9cf9c70c..75046669a94 100755
--- a/htdocs/webservices/demo_wsclient_thirdparty.php
+++ b/htdocs/webservices/demo_wsclient_thirdparty.php
@@ -28,7 +28,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
-$WS_DOL_URL = $dolibarr_main_url_root.'/webservices/server_thirdparty.php';
+$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php';
$WS_METHOD = 'getThirdParty';
diff --git a/htdocs/webservices/index.php b/htdocs/webservices/index.php
index 795cdf16cd1..4f70a5bacac 100644
--- a/htdocs/webservices/index.php
+++ b/htdocs/webservices/index.php
@@ -50,21 +50,18 @@ if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
-// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
-
// WSDL
print ''.$langs->trans("WSDLCanBeDownloadedHere").': ';
-$url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_other.php?wsdl';
+$url=DOL_MAIN_URL_ROOT.'/webservices/server_other.php?wsdl';
print img_picto('','object_globe.png').' '.''.$url." \n";
if ($conf->societe->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_thirdparty.php?wsdl';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php?wsdl';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
if ($conf->facture->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_invoice.php?wsdl';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php?wsdl';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
print ' ';
@@ -72,16 +69,16 @@ print ' ';
// Endpoint
print ''.$langs->trans("EndPointIs").': ';
-$url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_other.php';
+$url=DOL_MAIN_URL_ROOT.'/webservices/server_other.php';
print img_picto('','object_globe.png').' '.''.$url." \n";
if ($conf->societe->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_thirdparty.php';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
if ($conf->facture->enabled)
{
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/webservices/server_invoice.php';
+ $url=DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
print img_picto('','object_globe.png').' '.''.$url." \n";
}
print ' ';