Answers.Body: <p>The answer to this is that in the <code>general.php</code> I had a setup which somehow was giving trouble when setting <code>siteUrl</code>. Things were like this:</p>
  
  <pre><code>return array(
      '*' =&gt; array(
          'omitScriptNameInUrls' =&gt; true,
      ),
      'siteUrl' =&gt; array(
          'ru' =&gt; 'http://www.mysite.com/',
          'en_us' =&gt; 'http://www.mysite.com/en/'
      )
  );
  </code></pre>
  
  <p>While seemingly correct, in this setup <code>siteUrl</code> should be moved into <code>'*'</code> block, otherwise there comes the problem that I described earlier. So the correct version is this:</p>
  
  <pre><code>return array(
      '*' =&gt; array(
          'omitScriptNameInUrls' =&gt; true,
          'siteUrl' =&gt; array(
              'ru' =&gt; 'http://www.issuesinlinguistics.ru/',
              'en_us' =&gt; 'http://www.issuesinlinguistics.ru/en/'
          )
      )
  );
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-26T12:15:33.797Z
Answers.LastActivityDate: 2016-12-26T12:15:33.797Z
Answers.UserDisplayName: certainlyakey
Body: <p>I've got a problem where <code>siteURL</code> wasn't working for a localized version of my site. I have a site in two languages — Russian and English, with Russian exposed under <code>www.mysite.com</code> and English under <code>www.mysite.com/en/</code>. </p>
  
  <p>My problem was that <code>siteUrl</code> variable was always giving me a non localized version of the site URL (<code>www.mysite.com</code> instead of <code>www.mysite.com/en/</code>) 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.</p>
  
Tags: <localization><siteurl>
Title: siteUrl in Twig templates not working
ThreadText: # siteUrl in Twig templates not working
  
  (Asked by: username_0 on 2016-12-26)
  
  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.
  
  **Tags:** localization, siteurl
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-12-26. Score: 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/'
          )
      )
  );
  
  ```
  
  
  ---
  
  