Welcome Guest, Not a member yet? Register   Sign In
How to change the base_url with depending on the domain (two domains pointing to the same CI deployment)
#3

[eluser]cahva[/eluser]
Something like this in config.php (this is not mine, got from some thread and used succesfully):
Code:
$config['http_https'] = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https' : 'http';

$config['base_url'] = $config['http_https'];
$config['base_url'] .= '://'. $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);

That will work with any domain or subdomain that is pointing to your directory in virtual hosts. Plus as a bonus takes account if the url is secure(https) or not.

With that it would be quite trivial to change the logo depending on base_url(or straight with $_SERVER['HTTP_HOST']) on the page for example.


Messages In This Thread
How to change the base_url with depending on the domain (two domains pointing to the same CI deployment) - by El Forum - 10-05-2010, 03:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB