Answers.Body: <p>Have you tried putting <code>da_dk</code> in as the key in the siteUrl array?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T19:35:15.880Z
Answers.Text: Closer! That solves half of the problem. The links in the Entries listing now correctly link to `mysite.com/dk/tilbud-og-kampagner/{title}`. The trouble is that it still results in a 404. `mysite.com/dk/` correctly shows the index page. It seems like it's so close.
Answers.UserDisplayName: Ian Young
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T19:36:00.963Z
Answers.Text: And you obviously removed the `dk` part in the rewriterule?
Answers.UserDisplayName: megatrond
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T19:39:49.503Z
Answers.Text: Yep, that's back to `RewriteRule (.+) index.php?p=$1 [QSA,L]`.
Answers.UserDisplayName: Ian Young
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T19:42:34.230Z
Answers.Text: Oddly the live preview for the Danish version of the entry works fine. It's just the actual page URL itself which doesn't resolve.
Answers.UserDisplayName: Ian Young
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T19:46:47.463Z
Answers.Text: Maybe you need to do `define('CRAFT_LOCALE', 'da_dk');` as well?
Answers.UserDisplayName: megatrond
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T19:53:04.180Z
Answers.Text: Eureka! It finally works! The combination of using `da_dk` in the siteURL array and `define('CRAFT_LOCALE', 'da_dk');` in `/dk/index.php` got things resolving correctly. I can't thank you enough. That's had me stumped all afternoon.
Answers.UserDisplayName: Ian Young
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T20:02:18.200Z
Answers.Text: Glad to be able to help!
Answers.UserDisplayName: megatrond
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-23T19:24:15.053Z
Answers.LastActivityDate: 2015-07-23T19:24:15.053Z
Answers.UserDisplayName: megatrond
Body: <p>So I've setup locales following the <a href="http://buildwithcraft.com/docs/localization-guide" rel="nofollow noreferrer">official guide</a> and am going with the option where English (en_gb) is the default and Danish (da_dk) is in a sub-folder:</p>
  
  <p><a href="http://mysite.com" rel="nofollow noreferrer">http://mysite.com</a>      --> en default<br>
  <a href="http://mysite.com/dk/" rel="nofollow noreferrer">http://mysite.com/dk/</a>  --> dk sub-folder</p>
  
  <p>In summary, I've set the locales in Settings -> Locales</p>
  
  <p><a href="https://i.sstatic.net/geZQZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/geZQZ.png" alt="enter image description here"></a></p>
  
  <p>I've enabled them for my section (which is a channel):</p>
  
  <p><a href="https://i.sstatic.net/nZBxB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nZBxB.png" alt="enter image description here"></a></p>
  
  <p>I've set the siteURL array (single domain config):</p>
  
  <pre><code>'siteUrl' =&gt; array(
      'en' =&gt; 'http://mysite.com',
      'dk' =&gt; 'http://mysite.com/dk/',
  ),
  </code></pre>
  
  <p>I've created the folder structure and copied the index.php file and .htaccess file across to the <code>dk/</code> folder:</p>
  
  <pre><code>craft/
  public_html/            --&gt; mysite.com/
      .htaccess
      index.php
      dk/                 --&gt; mysite.com/dk/
          .htaccess
          index.php
  </code></pre>
  
  <p>And I've made the edit to the <code>dk/index.php</code> file:</p>
  
  <pre><code>// Path to your craft/ folder
  $craftPath = '../../craft';
  
  // Tell Craft to serve the Danish content
  define('CRAFT_LOCALE', 'dk');
  </code></pre>
  
  <p>Viewing my entry in English works fine:</p>
  
  <pre><code>http://mysite.com/segment/title  --&gt; Shows in English
  </code></pre>
  
  <p>Viewing the same entry in Danish directs to:</p>
  
  <pre><code>http://mysite.com/danishsegment/title --&gt; Missing /dk/ in URL. Nothing shown
  </code></pre>
  
  <p>So the preview link for Denmark doesn't include the country segment in the URL (<code>dk/</code>) and results in a 404. Even manually adding <code>dk/</code> to the URL results in a 404. It doesn't seem to be recognising the Danish locale at all. </p>
  
  <p>Any ideas as to what I'm doing wrong?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Here are the contents of my .htaccess files. All standard Craft with a Type to ensure PHP 5.6 is used:</p>
  
  <pre><code>AddType x-httpd-php56 .php
  
  &lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>The 'Offers' section (Channel) is set to have a different URL for each Locale:</p>
  
  <p><a href="https://i.sstatic.net/a4rD5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/a4rD5.png" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T17:02:07.007Z
Comments.Text: Is there a RewriteBase in the `.htaccess` in the Danish locale directory?
Comments.UserDisplayName: megatrond
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T17:51:38.717Z
Comments.Text: No RewriteBase in any .htaccess file. I looked for that originally in case that was causing the problem. I've updated my question with the contents of my .htaccess file for reference.
Comments.UserDisplayName: Ian Young
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T18:05:16.023Z
Comments.Text: What is AllowOverride set to?
Comments.UserDisplayName: megatrond
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T18:12:29.493Z
Comments.Text: In php.ini? I don't have access to the php.ini file directly but it is set to true. I have lots of other sites setup and working with custom .htaccess files. Even with Craft it's all been working fine. It's just now I'm adding in locales that for some reason it doesn't seem to want to add the `/dk/` segment to the URL - even when clicking on the link in the Entries panel of Craft. It doesn't include the `/dk/` part in the URL and adding it results in a 404. `http://mysite.com/dk/` shows the index page but the custom Section URL for Denmark is added or apparently working.
Comments.UserDisplayName: Ian Young
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T19:03:12.270Z
Comments.Text: Granted I have all the config in `/etc/httpd/vhosts/hostname.conf`, but I do have the locale prepended in the rewrite for the one multilocale site I have running:
  
  `RewriteRule (.+) /en/index.php?p=$1 [QSA,L]`
Comments.UserDisplayName: megatrond
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-23T19:10:37.160Z
Comments.Text: I've just given that a try in `/dk/.htaccess`, changing the RewriteRule to `RewriteRule (.+) /dk/index.php?p=$1 [QSA,L]` but still no dice. It's weird that in the Entries listing Under Danish the links to the individual entries in that channel link off to the site *without* `/dk/` in them. I'd have expected this to be wired in. Even adding it manually then returns a 404 but the `/dk/index.php` displays fine.
Comments.UserDisplayName: Ian Young
Tags: <localization>
Title: Can't get locales to work properly
ThreadText: # Can't get locales to work properly
  
  (Asked by: username_0 on 2015-07-23)
  
  So I've setup locales following the [official guide](http://buildwithcraft.com/docs/localization-guide) and am going with the option where English (en\_gb) is the default and Danish (da\_dk) is in a sub-folder:
  
  <http://mysite.com> --> en default  
  <http://mysite.com/dk/> --> dk sub-folder
  
  In summary, I've set the locales in Settings -> Locales
  
  [![enter image description here](https://i.sstatic.net/geZQZ.png)](https://i.sstatic.net/geZQZ.png)
  
  I've enabled them for my section (which is a channel):
  
  [![enter image description here](https://i.sstatic.net/nZBxB.png)](https://i.sstatic.net/nZBxB.png)
  
  I've set the siteURL array (single domain config):
  
  ```
  'siteUrl' => array(
      'en' => 'http://mysite.com',
      'dk' => 'http://mysite.com/dk/',
  ),
  
  ```
  
  I've created the folder structure and copied the index.php file and .htaccess file across to the `dk/` folder:
  
  ```
  craft/
  public_html/            --> mysite.com/
      .htaccess
      index.php
      dk/                 --> mysite.com/dk/
          .htaccess
          index.php
  
  ```
  
  And I've made the edit to the `dk/index.php` file:
  
  ```
  // Path to your craft/ folder
  $craftPath = '../../craft';
  
  // Tell Craft to serve the Danish content
  define('CRAFT_LOCALE', 'dk');
  
  ```
  
  Viewing my entry in English works fine:
  
  ```
  http://mysite.com/segment/title  --> Shows in English
  
  ```
  
  Viewing the same entry in Danish directs to:
  
  ```
  http://mysite.com/danishsegment/title --> Missing /dk/ in URL. Nothing shown
  
  ```
  
  So the preview link for Denmark doesn't include the country segment in the URL (`dk/`) and results in a 404. Even manually adding `dk/` to the URL results in a 404. It doesn't seem to be recognising the Danish locale at all.
  
  Any ideas as to what I'm doing wrong?
  
  **UPDATE:**
  
  Here are the contents of my .htaccess files. All standard Craft with a Type to ensure PHP 5.6 is used:
  
  ```
  AddType x-httpd-php56 .php
  
  <IfModule mod_rewrite.c>
      RewriteEngine On
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  </IfModule>
  
  ```
  
  **UPDATE 2:**
  
  The 'Offers' section (Channel) is set to have a different URL for each Locale:
  
  [![enter image description here](https://i.sstatic.net/a4rD5.png)](https://i.sstatic.net/a4rD5.png)
  
  **Tags:** localization
  
  > **Comments:**
  > **username_1**: Is there a RewriteBase in the `.htaccess` in the Danish locale directory?  
  > **username_0**: No RewriteBase in any .htaccess file. I looked for that originally in case that was causing the problem. I've updated my question with the contents of my .htaccess file for reference.  
  > **username_1**: What is AllowOverride set to?  
  > **username_0**: In php.ini? I don't have access to the php.ini file directly but it is set to true. I have lots of other sites setup and working with custom .htaccess files. Even with Craft it's all been working fine. It's just now I'm adding in locales that for some reason it doesn't seem to want to add the `/dk/` segment to the URL - even when clicking on the link in the Entries panel of Craft. It doesn't include the `/dk/` part in the URL and adding it results in a 404. `http://mysite.com/dk/` shows the index page but the custom Section URL for Denmark is added or apparently working.  
  > **username_1**: Granted I have all the config in `/etc/httpd/vhosts/hostname.conf`, but I do have the locale prepended in the rewrite for the one multilocale site I have running:  `RewriteRule (.+) /en/index.php?p=$1 [QSA,L]`  
  > **username_0**: I've just given that a try in `/dk/.htaccess`, changing the RewriteRule to `RewriteRule (.+) /dk/index.php?p=$1 [QSA,L]` but still no dice. It's weird that in the Entries listing Under Danish the links to the individual entries in that channel link off to the site *without* `/dk/` in them. I'd have expected this to be wired in. Even adding it manually then returns a 404 but the `/dk/index.php` displays fine.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-23. Score: 2 | Accepted answer
  
  Have you tried putting `da_dk` in as the key in the siteUrl array?
  
  > **Comments:**
  > **username_0**: Closer! That solves half of the problem. The links in the Entries listing now correctly link to `mysite.com/dk/tilbud-og-kampagner/{title}`. The trouble is that it still results in a 404. `mysite.com/dk/` correctly shows the index page. It seems like it's so close.  
  > **username_1**: And you obviously removed the `dk` part in the rewriterule?  
  > **username_0**: Yep, that's back to `RewriteRule (.+) index.php?p=$1 [QSA,L]`.  
  > **username_0**: Oddly the live preview for the Danish version of the entry works fine. It's just the actual page URL itself which doesn't resolve.  
  > **username_1**: Maybe you need to do `define('CRAFT_LOCALE', 'da_dk');` as well?  
  > **username_0**: Eureka! It finally works! The combination of using `da_dk` in the siteURL array and `define('CRAFT_LOCALE', 'da_dk');` in `/dk/index.php` got things resolving correctly. I can't thank you enough. That's had me stumped all afternoon.  
  > **username_1**: Glad to be able to help!  
  
  ---
  
  