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.