My site has 2 locales: en_us and nl_nl. I also have a Structure section called Pages, which targets both locales. For each locale, the section has an Entry URL Format:

  • en_us: en/{slug}
  • nl_nl: nl/{slug}

The Entry Template setting for the section is pages/_entry, and there is a template there.

Now, for an entry with the slug home for both locales, the URI nl/home gives me the correct page, but en/home gives me a 404.

Is my setup wrong? Do I need to explicitly create nl and en template folders?

  • Have you setup the CRAFT_LOCALE correctly? buildwithcraft.com/help/localization – Victor In Jun 24 '14 at 11:16
  • 1
    Hadn't set it at all. That helps. – Low Jun 24 '14 at 11:29
  • Note to self: locale should be exact. en_us != en and nl_nl != nl. – Low Jun 24 '14 at 11:34
  • I'll add it as an answer for clarity. – Victor In Jun 24 '14 at 11:49

Probably the CRAFT_LOCALE isn't set correctly. There is an in-depth knowledge article here.

To solve this, you could add a conditional to the /public/index.php:

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

if ( preg_match("/\/nl\//i", $_SERVER['REQUEST_URI']) ) { //Check if /nl/ is in the uri
    define('CRAFT_LOCALE', 'nl_nl');
else {
    define('CRAFT_LOCALE', 'en_us');

protected by Community Jan 7 '17 at 2:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.