Welcome Guest, Not a member yet? Register   Sign In
Change default language depending domain name
#1

[eluser]Unknown[/eluser]
Hi,
I have 1 hosting and 2 domains. Depending the domain name I want to load a default language but I can't. When I enter with the 2 differents domains CI load the same default language.
Is there a way to change de default language?
#2

[eluser]Aken[/eluser]
Just add some code to application/config/config.php where the language is set.
#3

[eluser]PhilTem[/eluser]
Put something like this into APPPATH . 'config/autoload.php'

Code:
$autoload['language'] = array($_SERVER['HTTP_HOST'] ? : $_SERVER['SERVER_NAME'])

which will load files
example.com_lang.php on example.com (or maybe www.example.com_lang.php on example.com and www.example.com respectively)
and
example.de_lang.php on example.de

You need to play with the argument $_SERVER['HTTP_HOST'] and maybe trim some parts from it or change the string somehow so that it is uniquely identified for both http://www.example.com and http://example.com (as well as maybe https://...)

But this should guide you towards one solution.
#4

[eluser]Aken[/eluser]
Phil, that still doesn't specify what language is needed.




Theme © iAndrew 2016 - Forum software by © MyBB