summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-10-07 23:29:26 +0200
committerAndrey Andreev <narf@devilix.net>2014-10-07 23:29:26 +0200
commit4bdb66759c24c41fefec7952b12a0595a671eaa2 (patch)
tree5908a2593ceed30a444ad914fa3a4fe81da3c0c9 /system
parent7cc3e99ebba58c260aea4c2a8d080684e067bb45 (diff)
Attempt a better base_url auto-detection
Diffstat (limited to 'system')
-rw-r--r--system/core/Config.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index db406dfde..18380a0db 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -78,9 +78,11 @@ class CI_Config {
{
if (isset($_SERVER['HTTP_HOST']))
{
- $base_url = (is_https() ? 'https' : 'http')
- .'://'.$_SERVER['HTTP_HOST']
- .substr($_SERVER['SCRIPT_NAME'], 0, -strlen(basename($_SERVER['SCRIPT_NAME'])));
+ $base_url = (is_https() ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].'/';
+ if ( ! empty($_SERVER['DOCUMENT_ROOT']))
+ {
+ $base_url .= ltrim(str_replace('\\', '/', substr(FCPATH, strlen($_SERVER['DOCUMENT_ROOT']))), '/\\');
+ }
}
else
{