1

I'm refering to this answer: https://magento.stackexchange.com/a/60657/51738

I know this question is quite old but I assume this workaround should still work on Magento 1.9.x and maybe also on Magento 2.x

I'm on Magento 1.9.3.9

I've tried to rework the solution, but now I always get 404 errors when switching the language.

What i try to achive is using identical language codes for several stores in a multi store setup but default shop shouldn't have an language code. In URLs it looks like this:

www.first_store.com
www.first_store.com/en/
www.first_store.com/fr/
www.second_store.com
www.second_store.com/en/
www.second_store.com/fr/
...

What I've done: I've created an website folder in magento root directory and also two sub folders within this website folder. I've copied the index.php and .htaccess to the website folder as well as to the two sub folders. I've modified the index.php as described in the solution. In all folders I've created symlinks for app,lib,.. folder which point to magento root directory.

first_store -> .htaccess,index.php -> Mage::run('first_store_de', 'store');
    en -> .htaccess,index.php -> Mage::run('first_store_en', 'store');
    fr -> .htaccess,index.php -> Mage::run('first_store_fr', 'store');

I've created a virtual host on apache for first_store.com which points on first_store folder.

System > Configuration > Web > Default Config > Add Store Code to Urls is No System > Configuration > Web I've set Base URL (and the other URLS plus there appendix)

Config Scope: first_store(website) -> http://www.first_store.com/
Config Scope: first_store(de) -> http://www.first_store.com/
Config Scope: first_store(en) -> http://www.first_store.com/en/
Config Scope: first_store(fr) -> http://www.first_store.com/fr/

Testing this in browser shows me that urls act like expected:
Browsing to www.first_store.com shows me the german store view, using the language switch to english opens www.first_store.com/en/ and shows english start page, for french view the same.

The issue occurs when going to an category or product where the url looks like this: www.first_store.com/category/subcategory.html shows me the subcategory in german store view, when I use the language switcher now it calls the url www.first_store.com/en/category/subcategory.html?___store=first_store_en and a 404 occurs. When I manually remove /en from url to get www.first_store.com/category/subcategory.html?___store=first_store_en the site loads the content in english.

My first and bigger problem are these 404 errors which I don't understand. Based on the configuration this shouldn't happen for my understanding. Btw. I'm on a development environment where cache and compilation is disabled, so this can't be the problem.
My second problem is that the language switch still appends the ugly store code when changing the language.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.