<p>Okay, so I found the answer. And the reason it wasn't working is because I've been using another <code>.htaccess</code> (a hybrid of h5bp and Craft) than the default that comes with the Craft download. And this <code>.htaccess</code> included a <code>RewriteBase</code>, which was set to <code>/</code>. So when one tried to access <code>/no/{slug}</code> the <code>RewriteBase</code> would send it up one folder, basically. So I had to go into each of the locales <code>.htaccess</code> and set their <code>RewriteBase</code> to <code>/no</code> and so on.</p>

<p>I'm just gonna leave it here, and I'm pretty sure I'm gonna find this post again the next time I'm making a multi-lingual site and don't understand why all of my links are broken...</p>

CC BY-SA 3.0
2017-11-03T17:22:59.527Z
Thank you! My whole site wasn't showing my secondary locale except the homepage, and it was the hidden file .htaccess that didn't copy over onto the FTP. thanks for the save!
mateostabio
CC BY-SA 3.0
2015-07-14T08:30:31.717Z
2015-07-14T08:30:31.717Z
peirix
<p>So I'm setting up a multi-lingual site for the first time, and I'm having some problems with the urls.</p>

<p>I followed the <a href="http://buildwithcraft.com/docs/localization-guide" rel="nofollow noreferrer">guide</a>, step by step. I've set up the <code>siteUrl</code> in <code>general.php</code>:</p>

<pre><code>'DEV' =&gt; array(
    'devMode' =&gt; true,
    'siteUrl' =&gt; array(
        'no' =&gt; 'http://teknologi.dev/no/',
        'en' =&gt; 'http://teknologi.dev/en/',
        'es' =&gt; 'http://teknologi.dev/es/'
    ),
),
</code></pre>

<p>And I guess that works, since I get a message in General settings that the siteUrl has been defined elsewhere.</p>

<p><img src="https://i.sstatic.net/5o1bS.png" alt="General settings"></p>

<p>Then I have a section called "Videos", which I've set up like this:</p>

<p><img src="https://i.sstatic.net/DPeqe.png" alt="Videos section"></p>

<p>And when I list out all the entries, the URL to one entry looks right, but I'm getting a 404. If I however change the Entry URL Format to include the locale letters, ex: <code>no/videoer/{slug}</code>, it works. But that makes the URLs write out the locales twice, so a URL might look like: <code>http://teknologi.dev/no/no/videoer/orkanger</code>, which of course gives a 404.</p>

<p>So is there some step I've missed?</p>

<p><strong>Edit:</strong> I also have this structure in my <code>www</code> folder:</p>

<pre><code>- .htaccess
- index.php // I needed this one for admin to work?
- no/
  - .htaccess
  - index.php
- en/
  - .htaccess
  - index.php
- es/
  - .htaccess
  - index.php
</code></pre>

<p>And in each of the localized index files I have changed the <code>craftPath</code> and the <code>CRAFT_LOCALE</code></p>

<pre><code>$craftPath = '../../craft';
define('CRAFT_LOCALE', 'no');
</code></pre>

<p>While the root index.php points <code>craftPath</code> to <code>../craft</code>.</p>

<p><strong>Edit 2:</strong> I tried deleting the root <code>index.php</code>, and while <code>/no/</code> still worked, every subpage (ex: <code>/no/videoer/</code>) gave this error message:</p>

<pre><code>The requested URL /index.php was not found on this server.
</code></pre>

<p>Do I need to do anything in my <code>.htaccess</code> for locales?</p>

CC BY-SA 3.0
2015-07-14T07:59:27.227Z
First time I did this I forgot to define `CRAFT_LOCALE` in each of the locales index.php, and I think that resulted in 404s all around.
megatrond
CC BY-SA 3.0
2015-07-14T08:12:17.543Z
@megatrond Yeah, I did that too. But now that you mentioned it, I'm a bit unsure about my root folder setup. I've updated my question with file structure.
peirix
CC BY-SA 3.0
2015-07-14T08:18:26.313Z
Don't think you need the index.php in your root. You would then access the CP from /no/admin/login. You could set up your htaccess so that /no/ is the default index page.
Patrick Nesbitt
CC BY-SA 3.0
2015-07-14T08:21:34.617Z
@PatrickNesbitt Tried deleting the index.php file as you said, but that gave a whole new error that I've not seen before. I updated the question.
peirix
CC BY-SA 3.0
2015-07-14T08:27:12.230Z
@perlix You shouldn't need anything in the htaccess file at root (except maybe a redirect to /no/)...your htaccess in each locale directory should be the standard Craft htaccess file.
Patrick Nesbitt
<localization>
Problems with channel and locales
# Problems with channel and locales

(Asked by: username_0 on 2015-07-14)

So I'm setting up a multi-lingual site for the first time, and I'm having some problems with the urls.
I followed the guide, step by step. I've set up the siteUrl in general.php:
'DEV' => array(
    'devMode' => true,
    'siteUrl' => array(
        'no' => 'http://teknologi.dev/no/',
        'en' => 'http://teknologi.dev/en/',
        'es' => 'http://teknologi.dev/es/'
    ),
),

And I guess that works, since I get a message in General settings that the siteUrl has been defined elsewhere.

Then I have a section called "Videos", which I've set up like this:

And when I list out all the entries, the URL to one entry looks right, but I'm getting a 404. If I however change the Entry URL Format to include the locale letters, ex: no/videoer/{slug}, it works. But that makes the URLs write out the locales twice, so a URL might look like: http://teknologi.dev/no/no/videoer/orkanger, which of course gives a 404.
So is there some step I've missed?
Edit: I also have this structure in my www folder:
- .htaccess
- index.php // I needed this one for admin to work?
- no/
  - .htaccess
  - index.php
- en/
  - .htaccess
  - index.php
- es/
  - .htaccess
  - index.php

And in each of the localized index files I have changed the craftPath and the CRAFT_LOCALE
$craftPath = '../../craft';
define('CRAFT_LOCALE', 'no');

While the root index.php points craftPath to ../craft.
Edit 2: I tried deleting the root index.php, and while /no/ still worked, every subpage (ex: /no/videoer/) gave this error message:
The requested URL /index.php was not found on this server.

Do I need to do anything in my .htaccess for locales?

**Tags:** localization

> **Comments:**
> **username_1**: First time I did this I forgot to define `CRAFT_LOCALE` in each of the locales index.php, and I think that resulted in 404s all around.  
> **username_0**: @username_1 Yeah, I did that too. But now that you mentioned it, I'm a bit unsure about my root folder setup. I've updated my question with file structure.  
> **username_2**: Don't think you need the index.php in your root. You would then access the CP from /no/admin/login. You could set up your htaccess so that /no/ is the default index page.  
> **username_0**: @PatrickNesbitt Tried deleting the index.php file as you said, but that gave a whole new error that I've not seen before. I updated the question.  
> **username_2**: @perlix You shouldn't need anything in the htaccess file at root (except maybe a redirect to /no/)...your htaccess in each locale directory should be the standard Craft htaccess file.  

---

## 1 answers

### Answer by username_0 on 2015-07-14. Score: 6 | Accepted answer

Okay, so I found the answer. And the reason it wasn't working is because I've been using another `.htaccess` (a hybrid of h5bp and Craft) than the default that comes with the Craft download. And this `.htaccess` included a `RewriteBase`, which was set to `/`. So when one tried to access `/no/{slug}` the `RewriteBase` would send it up one folder, basically. So I had to go into each of the locales `.htaccess` and set their `RewriteBase` to `/no` and so on.

I'm just gonna leave it here, and I'm pretty sure I'm gonna find this post again the next time I'm making a multi-lingual site and don't understand why all of my links are broken...

> **Comments:**
> **username_3**: Thank you! My whole site wasn't showing my secondary locale except the homepage, and it was the hidden file .htaccess that didn't copy over onto the FTP. thanks for the save!  

---

