Merge pull request #7476 from webbuilders-group/win-base-url-fix

BUGFIX: Fixed issue on Windows where the BASE_URL constant would get set wrong if the site was in a sub-folder of the web root
This commit is contained in:
Daniel Hensby 2017-10-12 15:31:53 +01:00 committed by GitHub
commit a244884117

View File

@ -100,7 +100,7 @@ if (!defined('BASE_URL')) {
// This tends not to work on CLI
$path = realpath($_SERVER['SCRIPT_FILENAME']);
if (substr($path, 0, strlen(BASE_PATH)) == BASE_PATH) {
$urlSegmentToRemove = substr($path, strlen(BASE_PATH));
$urlSegmentToRemove = str_replace('\\', '/', substr($path, strlen(BASE_PATH)));
if (substr($_SERVER['SCRIPT_NAME'], -strlen($urlSegmentToRemove)) == $urlSegmentToRemove) {
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
// ltrim('.'), normalise slashes to '/', and rtrim('/')