Welcome Guest, Not a member yet? Register   Sign In
base_url for multiple domains
#1

[eluser]Ngulo[/eluser]
hy guys,

what about $config['base_url']; when i have same application but multiple domains?

if my server can be acceded by www.site.com and www.site.us how can i set config base_url?

thx
#2

[eluser]Seb[/eluser]
You can try:

Code:
$config['base_url'] = strpos($_SERVER['HTTP_HOST'], 'site1') !== FALSE ? 'site1' : 'site2';

Just replace site1 and site2 with the two server domains...
#3

[eluser]CroNiX[/eluser]
Personally I'd just redirect all traffic from one domain to the other. Google doesn't like duplicate sites with the same content. I usually use one main site and have all of the other derivatives (.net, .org, .info, etc) to the main one using a simple htaccess rule. You can also easily do it with DNS.

This is assuming the content of those 2 sites is the same thing. If they are indeed different, the above solution is a good one. I do that so I only have to maintain one config for the live and dev servers.

$config['base_url'] = 'http://' . $_SERVER['SERVER_NAME'] . '/';
#4

[eluser]web-johnny[/eluser]
I agree the only diferrence that I put
Code:
$config['base_url']    = "http://".$_SERVER['HTTP_HOST'];
You must always had one main domain.




Theme © iAndrew 2016 - Forum software by © MyBB