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

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?

Just add some code to application/config/config.php where the language is set.

Put something like this into APPPATH . 'config/autoload.php'

$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)
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.

Phil, that still doesn't specify what language is needed.

Theme © iAndrew 2016 - Forum software by © MyBB