Answers.Body: <p>I was running into the same issue, struggling with it and it turns out that the official documentation is a bit misleading (no offense) when it comes to the <code>.htaccess</code> file, because it just mentions to copy it: </p>
  
  <p>You can not just copy the <code>.htaccess</code> but you have to change the <code>RewriteBase</code> parameter according to your folder structure in the <code>/public</code> folder.</p>
  
  <p>In your case the <code>.htaccess</code> file in the <code>/public</code> folder should start like this:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteBase /
  
      (...)
  </code></pre>
  
  <p>Within your <code>/public/es</code> folder you should have the following in the <code>.htaccess</code>:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteBase /es/
  
      (...)
  </code></pre>
  
  <p>Hope that helps!</p>
  
  <p><strong>TL;DR</strong> —> The RewriteBase in the <code>.htaccess</code> has to be changed according to the folder setup of the locales</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-09T17:06:22.213Z
Answers.Text: Thank you very much for finding the solution! You saved my project. It is still very odd to me that this is an issue as I've never had this issue on any of my other sites with CraftCMS, so I'm wondering if this is only an issue on my staging server because I used a subdomain for the staging? Thanks again!
Answers.UserDisplayName: mateostabio
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-17T09:46:17.097Z
Answers.LastActivityDate: 2018-04-17T09:53:44.810Z
Answers.LastEditDate: 2018-04-17T09:53:44.810Z
Answers.UserDisplayName: Tobias S.
Answers.Body: <p>Turn devMode on, trigger the 404, and look at the craft.log -- it should give you the URL that's causing the 404 error, which should help in debugging it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-21T17:36:53.117Z
Answers.Text: Any idea of what kinds of errors I should be looking for specifically in `craft.log`? I have something like this in there: `WHERE (elements_i18n.uri = :uri) AND (elements_i18n.locale = :locale) AND (elements_i18n.enabled = 1) AND (elements.enabled = 1) AND (elements.archived = 0). Bound with :uri='es/testing', :locale='en_us')` -- no idea if something like that is helpful.
Answers.UserDisplayName: Tyler
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-21T18:20:25.963Z
Answers.Text: You should see something like this:
  
   2015/09/21 17:42:59 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /var/www/oluminisites/craft/app/controllers/TemplatesController.php:59
   REQUEST_URI=/wp-includes/images/lndex.php?php4&root&upl&wphp4&abdullkarem&450799&wp&
Answers.UserDisplayName: andrew.welch
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-21T19:18:07.297Z
Answers.Text: Ah, gotcha. Yup, I'm seeing a lot of this: `2015/09/21 16:37:00 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /home/vagrant/cms/craft/app/controllers/TemplatesController.php:59`
Answers.UserDisplayName: Tyler
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-21T19:49:50.630Z
Answers.Text: There's a stack trace after that, but the end `REQUEST_URI` statement looks like this `REQUEST_URI=/es/testing`
Answers.UserDisplayName: Tyler
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-31T01:41:41.147Z
Answers.Text: @Tyler - any solution for this yet?
Answers.UserDisplayName: VoA
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-21T17:19:38.270Z
Answers.LastActivityDate: 2015-09-21T17:19:38.270Z
Answers.UserDisplayName: andrew.welch
Answers.Body: <p>Have you checked if your .htaccess file inside the /es directory gets interpreted? Write some crap in it and check if you get an error 500. If it does not, make sure you have AllowOverride set to All in your apache config.</p>
  
  <p>And also check if you're really using apache, otherwise you need to configure your Nginx, ... in a different way for the subdir. see here: <a href="https://github.com/nystudio107/nginx-craft" rel="nofollow noreferrer">https://github.com/nystudio107/nginx-craft</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T20:07:34.007Z
Answers.LastActivityDate: 2017-12-20T08:13:01.787Z
Answers.LastEditDate: 2017-12-20T08:13:01.787Z
Answers.UserDisplayName: Matthias Redl-Mann
Body: <p>I'm developing and running a Craft site locally through Laravel Homestead and am having issues with pages <code>404</code>'ing in a multi-locale setup.</p>
  
  <p>I've followed this guide closely: <a href="https://craftcms.com/docs/localization-guide" rel="nofollow noreferrer">https://craftcms.com/docs/localization-guide</a> and still running into problems.</p>
  
  <p>Basically, I want to have a Spanish locale set up, with English as the default top level. So my <code>example.com/xyz-article</code> will be the English version, and <code>example.com/es/xyz-article</code> will be the Spanish version.</p>
  
  <p>Here is how my folder structure is set up:</p>
  
  <pre><code>craft/
  public/
     .htaccess
     index.php
     es/
        index.php
        .htaccess
  </code></pre>
  
  <p>My <code>craft/config/general.php</code> is set up like this:</p>
  
  <pre><code>return array(
      '*' =&gt; array(
          'omitScriptNameInUrls' =&gt; true,
      ),
  
      '.dev' =&gt; array(
          'devMode' =&gt; true,
          'userSessionDuration'           =&gt; 'P101Y',
          'rememberedUserSessionDuration' =&gt; 'P101Y',
          'rememberUsernameDuration'      =&gt; 'P101Y',
          'invalidLoginWindowDuration'    =&gt; 'P101Y',
          'cooldownDuration'              =&gt; 'PT1S',
          'maxInvalidLogins'              =&gt; 101,
          'siteUrl' =&gt; array(
              'en_us' =&gt; 'http://example.dev/',
              'es' =&gt; 'http://example.dev/es/',
          )
      ),
  );
  </code></pre>
  
  <p>My <code>index.php</code> file under the <code>public/es</code> directory looks like this:</p>
  
  <pre><code>&lt;?php
  
  // Path to your craft/ folder
  $craftPath = '../../craft';
  
  // Tell Craft to serve the Spanish content
  define('CRAFT_LOCALE', 'es');
  
  // Do not edit below this line
  $path = rtrim($craftPath, '/').'/app/index.php';
  
  if (!is_file($path))
  {
      if (function_exists('http_response_code'))
      {
          http_response_code(503);
      }
  
      exit('Could not find your craft/ folder. Please ensure that &lt;strong&gt; &lt;code&gt;$craftPath&lt;/code&gt;&lt;/strong&gt; is set correctly in '.__FILE__);
  }
  
  require_once $path;
  </code></pre>
  
  <p>Finally, both of my <code>.htaccess</code> files inside the <code>public</code> and <code>es</code> directories are identical and look like this:</p>
  
  <pre><code>&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>Going to <code>example.dev</code> brings up the English homepage just fine, and <code>example.dev/es</code> brings up the Spanish homepage just fine. Everything looks good so far...but when I try to navigate into subdirectories, the <code>es/</code> pages always 404's. </p>
  
  <p>For instance, I set up a Single called "Testing", enabled it for both locales, and pointed it to a template inside my <code>craft/templates</code> folder called <code>testing/index.html</code>. <code>example.dev/testing</code> brings up the English version, but <code>example.dev/es/testing</code> gives me a 404 error.</p>
  
  <p>The odd thing is, is that the ugly version of the URL at <code>http://example.dev/index.php/es?p=testing</code> brings up the Spanish version, and Live Preview also works and displays/updates when I'm working on the Spanish version of the page.</p>
  
  <p>I'm at a bit of a loss as to where I'm going wrong here -- it seems like some paths are just screwy but I can't find where I may have entered something in incorrectly. Any help would be appreciated!</p>
  
  <p>UPDATE: Here are the log errors I'm getting when I load the <code>es/testing</code> page.</p>
  
  <p><a href="https://i.sstatic.net/h1qPz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/h1qPz.png" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-30T18:44:15.520Z
Comments.Text: Did you ever get this resolved? (I am having the identical problem)
Comments.UserDisplayName: Marion Newlevant
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-25T13:08:29.757Z
Comments.Text: Same problem here... No idea how to fix it.
Comments.UserDisplayName: jlcharette
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T16:07:31.340Z
Comments.Text: @Tyler I'm having the exact same issue as this in Craft3 RC2. Did you ever find a solution?
Comments.UserDisplayName: Joe Spurling
Tags: <localization><config><404>
Title: Multi-locale pages 404 on subdirectories
ThreadText: # Multi-locale pages 404 on subdirectories
  
  (Asked by: username_0 on 2015-09-21)
  
  I'm developing and running a Craft site locally through Laravel Homestead and am having issues with pages `404`'ing in a multi-locale setup.
  
  I've followed this guide closely: <https://craftcms.com/docs/localization-guide> and still running into problems.
  
  Basically, I want to have a Spanish locale set up, with English as the default top level. So my `example.com/xyz-article` will be the English version, and `example.com/es/xyz-article` will be the Spanish version.
  
  Here is how my folder structure is set up:
  
  ```
  craft/
  public/
     .htaccess
     index.php
     es/
        index.php
        .htaccess
  
  ```
  
  My `craft/config/general.php` is set up like this:
  
  ```
  return array(
      '*' => array(
          'omitScriptNameInUrls' => true,
      ),
  
      '.dev' => array(
          'devMode' => true,
          'userSessionDuration'           => 'P101Y',
          'rememberedUserSessionDuration' => 'P101Y',
          'rememberUsernameDuration'      => 'P101Y',
          'invalidLoginWindowDuration'    => 'P101Y',
          'cooldownDuration'              => 'PT1S',
          'maxInvalidLogins'              => 101,
          'siteUrl' => array(
              'en_us' => 'http://example.dev/',
              'es' => 'http://example.dev/es/',
          )
      ),
  );
  
  ```
  
  My `index.php` file under the `public/es` directory looks like this:
  
  ```
  <?php
  
  // Path to your craft/ folder
  $craftPath = '../../craft';
  
  // Tell Craft to serve the Spanish content
  define('CRAFT_LOCALE', 'es');
  
  // Do not edit below this line
  $path = rtrim($craftPath, '/').'/app/index.php';
  
  if (!is_file($path))
  {
      if (function_exists('http_response_code'))
      {
          http_response_code(503);
      }
  
      exit('Could not find your craft/ folder. Please ensure that <strong> <code>$craftPath</code></strong> is set correctly in '.__FILE__);
  }
  
  require_once $path;
  
  ```
  
  Finally, both of my `.htaccess` files inside the `public` and `es` directories are identical and look like this:
  
  ```
  <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>
  
  ```
  
  Going to `example.dev` brings up the English homepage just fine, and `example.dev/es` brings up the Spanish homepage just fine. Everything looks good so far...but when I try to navigate into subdirectories, the `es/` pages always 404's.
  
  For instance, I set up a Single called "Testing", enabled it for both locales, and pointed it to a template inside my `craft/templates` folder called `testing/index.html`. `example.dev/testing` brings up the English version, but `example.dev/es/testing` gives me a 404 error.
  
  The odd thing is, is that the ugly version of the URL at `http://example.dev/index.php/es?p=testing` brings up the Spanish version, and Live Preview also works and displays/updates when I'm working on the Spanish version of the page.
  
  I'm at a bit of a loss as to where I'm going wrong here -- it seems like some paths are just screwy but I can't find where I may have entered something in incorrectly. Any help would be appreciated!
  
  UPDATE: Here are the log errors I'm getting when I load the `es/testing` page.
  
  [![enter image description here](https://i.sstatic.net/h1qPz.png)](https://i.sstatic.net/h1qPz.png)
  
  **Tags:** localization, config, 404
  
  > **Comments:**
  > **username_1**: Did you ever get this resolved? (I am having the identical problem)  
  > **username_2**: Same problem here... No idea how to fix it.  
  > **username_3**: @username_0 I'm having the exact same issue as this in Craft3 RC2. Did you ever find a solution?  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_4 on 2018-04-17. Score: 2
  
  I was running into the same issue, struggling with it and it turns out that the official documentation is a bit misleading (no offense) when it comes to the `.htaccess` file, because it just mentions to copy it:
  
  You can not just copy the `.htaccess` but you have to change the `RewriteBase` parameter according to your folder structure in the `/public` folder.
  
  In your case the `.htaccess` file in the `/public` folder should start like this:
  
  ```
  <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
  
      (...)
  
  ```
  
  Within your `/public/es` folder you should have the following in the `.htaccess`:
  
  ```
  <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /es/
  
      (...)
  
  ```
  
  Hope that helps!
  
  **TL;DR** —> The RewriteBase in the `.htaccess` has to be changed according to the folder setup of the locales
  
  > **Comments:**
  > **username_5**: Thank you very much for finding the solution! You saved my project. It is still very odd to me that this is an issue as I've never had this issue on any of my other sites with CraftCMS, so I'm wondering if this is only an issue on my staging server because I used a subdomain for the staging? Thanks again!  
  
  ---
  
  ### Answer by username_6 on 2015-09-21. Score: 1
  
  Turn devMode on, trigger the 404, and look at the craft.log -- it should give you the URL that's causing the 404 error, which should help in debugging it.
  
  > **Comments:**
  > **username_0**: Any idea of what kinds of errors I should be looking for specifically in `craft.log`? I have something like this in there: `WHERE (elements_i18n.uri = :uri) AND (elements_i18n.locale = :locale) AND (elements_i18n.enabled = 1) AND (elements.enabled = 1) AND (elements.archived = 0). Bound with :uri='es/testing', :locale='en_us')` -- no idea if something like that is helpful.  
  > **username_6**: You should see something like this:   2015/09/21 17:42:59 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /var/www/oluminisites/craft/app/controllers/TemplatesController.php:59  REQUEST_URI=/wp-includes/images/lndex.php?php4&root&upl&wphp4&abdullkarem&450799&wp&  
  > **username_0**: Ah, gotcha. Yup, I'm seeing a lot of this: `2015/09/21 16:37:00 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /home/vagrant/cms/craft/app/controllers/TemplatesController.php:59`  
  > **username_0**: There's a stack trace after that, but the end `REQUEST_URI` statement looks like this `REQUEST_URI=/es/testing`  
  > **username_7**: @username_0 - any solution for this yet?  
  
  ---
  
  ### Answer by username_8 on 2017-12-19. Score: 1
  
  Have you checked if your .htaccess file inside the /es directory gets interpreted? Write some crap in it and check if you get an error 500. If it does not, make sure you have AllowOverride set to All in your apache config.
  
  And also check if you're really using apache, otherwise you need to configure your Nginx, ... in a different way for the subdir. see here: <https://github.com/nystudio107/nginx-craft>
  
  
  ---
  
  