-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Dynamic Base Url
World Wide Web Server edited this page Jul 4, 2012
·
6 revisions
Many times the base url in config/config.php must be set it to localhost for development and reset when it goes live. More importantly is when you are dealing with a single application accessible from multiple domains. So this provides the ability to easily set the value dynamically. I am not sure why I have neither come across anyone mentioning issues with it or its requirement considering what can be easily achieved. Never the less it is still very simple although you could add security measures since the input instance is not directly available in the config files since they don't reside in the superclass.
Just overwrite the line in config/config.php with the following:
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';