summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Config.php13
1 files changed, 3 insertions, 10 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index f630d1709..56259bd06 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -76,16 +76,9 @@ class CI_Config {
// Set the base_url automatically if none was provided
if (empty($this->config['base_url']))
{
- if (isset($_SERVER['HTTP_HOST']))
- {
- $base_url = is_https() ? 'https' : 'http';
- $base_url .= '://'.$_SERVER['HTTP_HOST']
- .str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
- }
- else
- {
- $base_url = 'http://localhost/';
- }
+ $base_url = (is_https() ? 'https' : 'http') . '://'
+ . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost')
+ . str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$this->set_item('base_url', $base_url);
}