{"record":{"id":"c45cd5069e598944","repo":"Dolibarr/dolibarr","slug":"error-wrong-dolibarr-main-url-root-alt-value-in-conf-php","errorCode":null,"errorMessage":"Error: Wrong $dolibarr_main_url_root_alt value in conf.php file. We now use a relative path to $dolibarr_main_url_root to build alternate URLs. Value found: ${value} Should be replaced by: ${correct_value}","messagePattern":"Error: Wrong \\$dolibarr_main_url_root_alt value in conf\\.php file\\. We now use a relative path to \\$dolibarr_main_url_root to build alternate URLs\\. Value found: (.+?) Should be replaced by: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"htdocs/master.inc.php","lineNumber":194,"sourceCode":"$conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance\n$conf->file->dol_main_url_root = $dolibarr_main_url_root;\t// Define url inside the config file\n$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define an array of document root directories ('/home/htdocs')\n$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define an array of url root path ('' or '/dolibarr')\nif (!empty($dolibarr_main_document_root_alt)) {\n\t// dolibarr_main_document_root_alt can contains several directories\n\t$values = preg_split('/[;,]/', $dolibarr_main_document_root_alt);\n\t$i = 0;\n\tforeach ($values as $value) {\n\t\t$conf->file->dol_document_root['alt'.($i++)] = (string) $value;\n\t}\n\t$values = preg_split('/[;,]/', (string) $dolibarr_main_url_root_alt);\n\t$i = 0;\n\tforeach ($values as $value) {\n\t\tif (preg_match('/^http(s)?:/', $value)) {\n\t\t\t// Show error message\n\t\t\t$correct_value = str_replace($dolibarr_main_url_root, '', $value);\n\t\t\tprint '<b>Error:</b><br>'.\"\\n\";\n\t\t\tprint 'Wrong <b>$dolibarr_main_url_root_alt</b> value in <b>conf.php</b> file.<br>'.\"\\n\";\n\t\t\tprint 'We now use a relative path to $dolibarr_main_url_root to build alternate URLs.<br>'.\"\\n\";\n\t\t\tprint 'Value found: '.$value.'<br>'.\"\\n\";\n\t\t\tprint 'Should be replaced by: '.$correct_value.'<br>'.\"\\n\";\n\t\t\tprint \"Or something like following examples:<br>\\n\";\n\t\t\tprint \"\\\"/extensions\\\"<br>\\n\";\n\t\t\tprint \"\\\"/extensions1,/extensions2,...\\\"<br>\\n\";\n\t\t\tprint \"\\\"/../extensions\\\"<br>\\n\";\n\t\t\tprint \"\\\"/custom\\\"<br>\\n\";\n\t\t\texit;\n\t\t}\n\t\t$conf->file->dol_url_root['alt'.($i++)] = (string) $value;\n\t}\n}\n\n// Load the main includes of common libraries\nif (!defined('NOREQUIREUSER')) {\n\trequire_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; // Need 500ko memory\n}","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/Dolibarr/dolibarr/blob/598aa4bdada683d17ca04b1842548821ff0eb6c6/htdocs/master.inc.php#L176-L212","documentation":"During bootstrap, master.inc.php parses the $dolibarr_main_url_root_alt value from conf.php. Since Dolibarr switched to relative alternate URLs, any entry starting with http:// or https:// is rejected: the script prints this error with the suggested relative replacement (the absolute value minus $dolibarr_main_url_root) and exits.","triggerScenarios":"conf.php sets $dolibarr_main_url_root_alt to an absolute URL such as 'http://myserver/dolibarr/custom' or 'https://example.com/extensions'; master.inc.php's preg_match('/^http(s):/') check matches and bootstrapping aborts.","commonSituations":"Upgrading an old Dolibarr install whose conf.php predates the relative-path convention; copying conf.php snippets from old tutorials; migrations between servers where the old absolute URL format was kept.","solutions":["Open htdocs/conf/conf.php and locate $dolibarr_main_url_root_alt","Replace each absolute URL with the relative path shown in the error's 'Should be replaced by' line (absolute value minus $dolibarr_main_url_root), e.g. '/custom'","Use one of the documented formats: \"/extensions\", \"/extensions1,/extensions2\", or \"/../extensions\"","Reload the page; if the error persists clear any opcache/PHP cache"],"exampleFix":"// before (conf.php)\n$dolibarr_main_url_root='http://myserver/dolibarr';\n$dolibarr_main_url_root_alt='http://myserver/dolibarr/custom';\n// after\n$dolibarr_main_url_root='http://myserver/dolibarr';\n$dolibarr_main_url_root_alt='/custom';","handlingStrategy":"validation","validationCode":"if (preg_match('/^https?:/', $dolibarr_main_url_root_alt)) {\n    die('conf.php: $dolibarr_main_url_root_alt must be a path relative to $dolibarr_main_url_root, e.g. /custom');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep $dolibarr_main_url_root_alt as a relative path like /custom","Re-check conf.php after every Dolibarr upgrade","Use comma-separated relative paths for multiple alt roots","Never copy conf.php values from pre-2014 tutorials"],"tags":["config","bootstrap","dolibarr"],"backgroundTag":"invalid-config-value","analyzedSha":"598aa4bdada683d17ca04b1842548821ff0eb6c6","analyzedAt":"2026-09-14T11:12:15.309Z","contentChangedAt":"2026-09-14T11:12:15.309Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}