2

I've got a problem where siteURL wasn't working for a localized version of my site. I have a site in two languages — Russian and English, with Russian exposed under www.mysite.com and English under www.mysite.com/en/.

My problem was that siteUrl variable was always giving me a non localized version of the site URL (www.mysite.com instead of www.mysite.com/en/) on the pages in English, even though other localized features were working fine (strings were translated into English, correct entries output etc.). See below for the solution.

1 Answer 1

2

The answer to this is that in the general.php I had a setup which somehow was giving trouble when setting siteUrl. Things were like this:

return array(
    '*' => array(
        'omitScriptNameInUrls' => true,
    ),
    'siteUrl' => array(
        'ru' => 'http://www.mysite.com/',
        'en_us' => 'http://www.mysite.com/en/'
    )
);

While seemingly correct, in this setup siteUrl should be moved into '*' block, otherwise there comes the problem that I described earlier. So the correct version is this:

return array(
    '*' => array(
        'omitScriptNameInUrls' => true,
        'siteUrl' => array(
            'ru' => 'http://www.issuesinlinguistics.ru/',
            'en_us' => 'http://www.issuesinlinguistics.ru/en/'
        )
    )
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.