mirror of
https://github.com/bcit-ci/CodeIgniter.git
synced 2025-02-20 11:13:29 +08:00
...
parent
17b68daca3
commit
87bfc3fef0
@ -2,4 +2,26 @@ Many times the base url in config/config.php must be set it to localhost for de
|
||||
|
||||
Just overwrite the line in config/config.php with the following:
|
||||
|
||||
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
|
||||
/*
|
||||
*$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
|
||||
*/
|
||||
|
||||
EDIT:
|
||||
|
||||
WanWizard, as known on the forums has posted a much more thorough and flexible solution which takes apps ran in a subdirectory or through SSL (https) into account.
|
||||
|
||||
$config['base_url'] = (isset($_SERVER['HTTPS']) ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . ROOT;
|
||||
|
||||
The constant ROOT is defined in index.php as:
|
||||
|
||||
define('ROOTPATH', realpath(dirname(__FILE__)) . '/');
|
||||
|
||||
// installed in the docroot?
|
||||
if (realpath(dirname(__FILE__)) == $_SERVER['DOCUMENT_ROOT'])
|
||||
{
|
||||
define('ROOT', '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
define('ROOT', substr(ROOTPATH, strlen($_SERVER['DOCUMENT_ROOT'])+1));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user