<p>First off, make sure you have .htaccess files in both the en and fr folders and this per the <a href="https://craftcms.com/docs/localization-guide#step-5-set-up-the-files" rel="nofollow noreferrer">localization guide</a>.</p>

<p>Secondly, you're missing a comma in the siteUrl array:</p>

<pre><code>'siteUrl' =&gt; array(
    'en' =&gt; 'http://etf-craft.dev/en/',
    'fr' =&gt; 'http://etf-craft.dev/fr/' &lt;--------add comma here-----
),
</code></pre>

CC BY-SA 3.0
2017-11-19T09:54:16.237Z
That comma isn't necessary there...
andrew.welch
CC BY-SA 3.0
2017-11-20T17:56:01.070Z
Aside from avoiding future syntax errors, should he add other languages in the future, you're right. Then again,  ¯\_(ツ)_/¯
Natetronn
CC BY-SA 3.0
2017-11-15T18:01:33.050Z
2017-11-15T18:01:33.050Z
Natetronn
<p>I have a localized site set up where the language switcher and translations are working fine. However when I link to internal pages it goes to a 404.</p>

<p>general.php has this:</p>

<pre><code> //local only
 'etf-craft.dev' =&gt; array(
    'devMode' =&gt; true,
    'siteUrl' =&gt; array(
       'en' =&gt; 'http://etf-craft.dev/en/',
       'fr' =&gt; 'http://etf-craft.dev/fr/'
   ),
   'environmentVariables' =&gt; array(
        'environment' =&gt; 'local',
        'basePath' =&gt; 'D:\sites\etf-craft\public_html',
        'baseUrl'  =&gt; 'http://etf-craft.dev',
    )
),
</code></pre>

<p>site structure is like this:</p>

<ul>
<li>craft</li>
<li>public</li>
<li>public/en/</li>
<li>public/fr/</li>
</ul>

<p>index.php in /fr/ and /en/ directories contains the following where french says /fr/ instead of /en/:</p>

<p>

<pre><code>// Path to your craft/ folder
$craftPath = '../../craft';

// Tell Craft to serve the English content
define('CRAFT_LOCALE', 'en');
</code></pre>

<p>One link I've created that 404s on me is:</p>

<pre><code>  &lt;li&gt;
    &lt;a href="/{{ craft.locale }}/news" class="news"&gt;{{ "News" | t}}
      &lt;i class="arrow right"&gt;&lt;/i&gt;
    &lt;/a&gt;
  &lt;/li&gt;
</code></pre>

<p>What I expect is that it takes me to <a href="http://etf-craft.dev/en/news" rel="nofollow noreferrer">http://etf-craft.dev/en/news</a> and the news page shows up. However I end up going to a 404.</p>

<p>However if I manually remove the /en/ from the address bar the news template shows up correctly.</p>

<ul>
<li><strong>not working</strong> - <a href="http://etf-craft.dev/en/news" rel="nofollow noreferrer">http://etf-craft.dev/en/news</a></li>
<li><strong>working</strong> - <a href="http://etf-craft.dev/news" rel="nofollow noreferrer">http://etf-craft.dev/news</a></li>
</ul>

<p>What am I doing wrong?</p>

CC BY-SA 3.0
2017-11-13T22:20:32.710Z
Does each folder (en|fr) have an .htaccess file too?
Natetronn
CC BY-SA 3.0
2017-11-13T22:22:49.303Z
It did not, but I copied one in now and no change.
CreateSean
CC BY-SA 3.0
2017-11-13T22:27:42.107Z
Did you update the craftPath var in both index.php `$craftPath = '../../craft';`?
Natetronn
CC BY-SA 3.0
2017-11-13T22:39:44.963Z
@Natetronn Yes that was previously set correctly - updating the post now with that information
CreateSean
CC BY-SA 3.0
2017-11-13T22:52:24.823Z
Not sure if it matters either way but, looks like you're missing a comma in the siteUrl array `'fr' => 'http://etf-craft.dev/fr/',`
Natetronn
CC BY-SA 3.0
2017-11-14T13:50:28.590Z
@Natetronn And now it's working. Thank you.
CreateSean
CC BY-SA 3.0
2017-11-15T13:05:18.930Z
@CreateSean can you add an official answer and accept that?
carlcs
<localization>
Localization - linking to other pages goes to 404
# Localization - linking to other pages goes to 404

(Asked by: username_0 on 2017-11-10)

I have a localized site set up where the language switcher and translations are working fine. However when I link to internal pages it goes to a 404.
general.php has this:
 //local only
 'etf-craft.dev' => array(
    'devMode' => true,
    'siteUrl' => array(
       'en' => 'http://etf-craft.dev/en/',
       'fr' => 'http://etf-craft.dev/fr/'
   ),
   'environmentVariables' => array(
        'environment' => 'local',
        'basePath' => 'D:\sites\etf-craft\public_html',
        'baseUrl'  => 'http://etf-craft.dev',
    )
),

site structure is like this:

craft
public
public/en/
public/fr/

index.php in /fr/ and /en/ directories contains the following where french says /fr/ instead of /en/:

// Path to your craft/ folder
$craftPath = '../../craft';

// Tell Craft to serve the English content
define('CRAFT_LOCALE', 'en');

One link I've created that 404s on me is:
  
    {{ "News" | t}}
      
    
  

What I expect is that it takes me to http://etf-craft.dev/en/news and the news page shows up. However I end up going to a 404.
However if I manually remove the /en/ from the address bar the news template shows up correctly.

not working - http://etf-craft.dev/en/news
working - http://etf-craft.dev/news

What am I doing wrong?

**Tags:** localization

> **Comments:**
> **username_1**: Does each folder (en|fr) have an .htaccess file too?  
> **username_0**: It did not, but I copied one in now and no change.  
> **username_1**: Did you update the craftPath var in both index.php `$craftPath = '../../craft';`?  
> **username_0**: @username_1 Yes that was previously set correctly - updating the post now with that information  
> **username_1**: Not sure if it matters either way but, looks like you're missing a comma in the siteUrl array `'fr' => 'http://etf-craft.dev/fr/',`  
> **username_0**: @username_1 And now it's working. Thank you.  
> **username_2**: @username_0 can you add an official answer and accept that?  

---

## 1 answers

### Answer by username_1 on 2017-11-15. Score: 3 | Accepted answer

First off, make sure you have .htaccess files in both the en and fr folders and this per the localization guide.
Secondly, you're missing a comma in the siteUrl array:
'siteUrl' => array(
    'en' => 'http://etf-craft.dev/en/',
    'fr' => 'http://etf-craft.dev/fr/' <--------add comma here-----
),

> **Comments:**
> **username_3**: That comma isn't necessary there...  
> **username_1**: Aside from avoiding future syntax errors, should he add other languages in the future, you're right. Then again,  ¯\_(ツ)_/¯  

---

