diff options
Diffstat (limited to 'system/core/Config.php')
-rw-r--r-- | system/core/Config.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/system/core/Config.php b/system/core/Config.php index 728e28dd8..ec852b133 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -76,11 +76,16 @@ class CI_Config { // Set the base_url automatically if none was provided if (empty($this->config['base_url'])) { - $script_basename = basename($_SERVER['SCRIPT_NAME']); + $script_dir = strtr(dirname($_SERVER['SCRIPT_NAME']), '\\', '/'); + + if ($script_dir !== '/') + { + $script_dir .= '/'; + } $base_url = (is_https() ? 'https' : 'http') . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost') - . preg_replace('/'.preg_quote($script_basename).'$/', '', $_SERVER['SCRIPT_NAME']); + . $script_dir; $this->set_item('base_url', $base_url); } |