I have installed and built a website using Craft CMS (with latest updates). I'm running this Craft installation on a Homestead virtual machine.
When I enabled localization and translated entries in a structure section, the url opens a 404 page.
In my setup I have two locales nb_no and en. Both locales are enabled for the section artists. Both locales are using the same url structure for entries: artists\{slug}.
My configuration for siteUrl is as follows:
'siteUrl' => array(
'en' => 'http://page.craft.dev/en/',
'nb_no' => 'http://page.craft.dev',
),
Debbuging the problem I see that there is an error in TemplatesController.php. In the function actionRender($template, array $variables = array()) the value of $template is en/artists/andre-bratten instead of artists/_entry as is the case for the main language entry.
Further exploration of logs shows me that Craft executes the following query which returns no result:
[09:30:32.080][trace][system.db.CDbCommand]
Querying SQL: SELECT `elements`.`id`, `elements`.`type`
FROM `craft_elements` `elements`
JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id
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='en/artists/andre-bratten', :locale='nb_no'
in /home/vagrant/web/ekko/craft/app/services/ElementsService.php (151)
in /home/vagrant/web/ekko/craft/app/etc/web/UrlManager.php (281)
in /home/vagrant/web/ekko/craft/app/etc/web/UrlManager.php (140)
In my database elements_i18n table the entries both have uri = "artists/andre-bratten" and different locales.
As well there is a problem with wrong locale in the sql query (nb_no instead of en). I set CRAFT_LOCALE to en in the public\en\index.php file.
As I'm rereading this I think that there could be a problem with resolving the correct path (i.e. removing en/ from the front) when the locale is set incorrectly. Does anyone have any ideas why this is happening?
Update
I found out that when I access http:\\page.craft.dev\en\ I am loading public\en\index.php. However when I access http:\\page.craft.dev\en\artists\{slug} it loads public\index.php. So I assume there is a problem with Homestead and nginx?
http:\\page.craft.dev\en\I am loadingpublic\en\index.php. However when I accesshttp:\\page.craft.dev\en\artists\{slug}it loadspublic\index.php. So I assume there is a problem with Homestead and nginx? – pauliusef Oct 10 '15 at 10:51