siteUrl in Twig templates not working 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.
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(
    '*' =&gt; array(
        'omitScriptNameInUrls' =&gt; true,
    ),
    'siteUrl' =&gt; array(
        'ru' =&gt; 'http://www.mysite.com/',
        'en_us' =&gt; '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(
    '*' =&gt; array(
        'omitScriptNameInUrls' =&gt; true,
        'siteUrl' =&gt; array(
            'ru' =&gt; 'http://www.issuesinlinguistics.ru/',
            'en_us' =&gt; 'http://www.issuesinlinguistics.ru/en/'
        )
    )
);