diff --git a/core/Core.php b/core/Core.php index 39d8632e9..ca042157a 100755 --- a/core/Core.php +++ b/core/Core.php @@ -134,7 +134,10 @@ if(!defined('BASE_URL')) { // If that didn't work, failover to the old syntax. Hopefully this isn't necessary, and maybe // if can be phased out? if(!defined('BASE_URL')) { - define('BASE_URL', rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), DIRECTORY_SEPARATOR)); + $dir = strpos($_SERVER['SCRIPT_NAME'], 'index.php') + ? dirname($_SERVER['SCRIPT_NAME']) + : dirname(dirname($_SERVER['SCRIPT_NAME'])); + define('BASE_URL', rtrim($dir, DIRECTORY_SEPARATOR)); } } define('MODULES_DIR', 'modules'); diff --git a/main.php b/main.php index cb7a04645..bfa7b7e6e 100644 --- a/main.php +++ b/main.php @@ -107,7 +107,7 @@ require_once("core/model/DB.php"); // Redirect to the installer if no database is selected if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) { $s = (isset($_SERVER['SSL']) || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')) ? 's' : ''; - $installURL = "http$s://" . $_SERVER['HTTP_HOST'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . '/install.php'; + $installURL = "http$s://" . $_SERVER['HTTP_HOST'] . BASE_URL . '/install.php'; // The above dirname() will equate to "\" on Windows when installing directly from http://localhost (not using // a sub-directory), this really messes things up in some browsers. Let's get rid of the backslashes