mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
commit
a244884117
@ -100,7 +100,7 @@ if (!defined('BASE_URL')) {
|
|||||||
// This tends not to work on CLI
|
// This tends not to work on CLI
|
||||||
$path = realpath($_SERVER['SCRIPT_FILENAME']);
|
$path = realpath($_SERVER['SCRIPT_FILENAME']);
|
||||||
if (substr($path, 0, strlen(BASE_PATH)) == BASE_PATH) {
|
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) {
|
if (substr($_SERVER['SCRIPT_NAME'], -strlen($urlSegmentToRemove)) == $urlSegmentToRemove) {
|
||||||
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
|
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
|
||||||
// ltrim('.'), normalise slashes to '/', and rtrim('/')
|
// ltrim('.'), normalise slashes to '/', and rtrim('/')
|
||||||
|
Loading…
Reference in New Issue
Block a user