Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

URL Rewrite rules not working when changing language
 
Kunzi
Member
 
Total Posts:  44
Joined:  2009-02-11
 

I have set up custom URL Rewrite rules via Magento admin for my multilingual shop and everything works when I change language and then navigate through my category navigation or info page navigation links. The right language version of the page is shown as it should.

Now if I change the language again while being on some page other than home page, Magento returns me to the home page and adds for example this to end of url: ?___store=default&___from_store=deutsch.

I would like it to serve me automatically the right language page and not the home page.

To be more clear, if I’m on this page:

www.example.com/info

and change the language via language switcher, it gives me this page:

www.example.com/?___store=deutsch&___from_store=default

When it should give me:

www.example.com/german-info-page

I have made the URL Rewrites like in this guide:

http://www.hybridforge.com/blog/685/software/magento-tips/magento-multi-language-cms/

So the URL rewrite is set up as “custom”. The english language is selected and then the ID path and Request path is set as german-info-page and Target path is set to info

I also have set up the other way around: Custom, German, ID path and Request path = german-info-page, and finally Target path = info

Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ergodeit
Jr. Member
 
Total Posts:  7
Joined:  2012-05-02
Richmond, Texas
 

I just gone through the support link that you have inserted in the talking.

I found this “In the case of the switch to the English site, we want it to redirect to “english-content-item”. We want it to be a 301 Permanent Redirect. You can add whatever description you need and Save.”

And you need to do the same thing with French and german URL also.

It means, after getting the set up done you will need to re-direct them to their respective set page.

“Now, do the same for the French site, so use “english-content-item” for the ID and Request paths and “french-content-item” for the target path. Be sure select the French view under “Store”. Save that.”

Please follow this one to get the set up done for your URL translated to respective language.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kunzi
Member
 
Total Posts:  44
Joined:  2009-02-11
 

Thanks for the reply!

I have done as the guide suggested and set up the redirects also (I forgot to mention that). This works on my test shop that I just made, but it does not work in my actual shop.

For some reason Magento decides to drop the url of the destination page when changing the store view.

I wonder if there is a way to reset all URL rewrites and do them again somehow, so that the whole shop does not fall off the earth…

 
Magento Community Magento Community
Magento Community
Magento Community
 
ergodeit
Jr. Member
 
Total Posts:  7
Joined:  2012-05-02
Richmond, Texas
 

OK, it means you have gone thorugh all the process till now.

Now just give a try to magento URL re-writing with the step mentioned in the link below -

http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index

It could help you. Go through it....

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kunzi
Member
 
Total Posts:  44
Joined:  2009-02-11
 

Thanks.

The link suggest to set on the use of store code in URL. This setting is not needed in any of the test stores I have created. For some reason this one particular site is having problems when changing the store view (=language) in store front. Also when I tried to set that setting on, there was some 404 errors in test store even after re-indexing.

I have tried manually emptying the sessions and cache directories on server, but that has not helped.

I have not yet got the balls to try and manually remove all the URL Rewrites from the database and do re-indexing, but I guess I have to try that as well. I hope it does not bring any catastrophies.

 
Magento Community Magento Community
Magento Community
Magento Community
 
headseller
Jr. Member
 
Total Posts:  8
Joined:  2012-04-18
 

Hi, Have any one of you known the following issue:

I have moved a Magento website to a new server to optimize speed. The temporary domain name is in form of

http://cpanel28.servername.no/~domainname/

Everything works perfectly unless the homeapge. When I go to home page it return 404 page. If I add index.php at the end, it loads the homepage correctly. The strange thing is only homepage has this error. All other pages load correctly without index.php? Can anyone sugest me what might cause this issue?

Thank you so much

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kunzi
Member
 
Total Posts:  44
Joined:  2009-02-11
 

I managed to find the cause of my mysterious store view change problem. It turns out that when cache is enabled in magento admin it somehow messes things up. I disabled the cache completely and all started working like a dream.

Still have to figure out how to get cache working…

Any ideas why cache would prevent the right URL being deployed when changing store view?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ergodeit
Jr. Member
 
Total Posts:  7
Joined:  2012-05-02
Richmond, Texas
 
Kunzi - 31 May 2012 10:48 AM

I managed to find the cause of my mysterious store view change problem. It turns out that when cache is enabled in magento admin it somehow messes things up. I disabled the cache completely and all started working like a dream.

Still have to figure out how to get cache working…

Any ideas why cache would prevent the right URL being deployed when changing store view?

I am really happy that you have got the solution.

Here, what are you trying to figure out with the cache and URL? It’s quite unclear, are you mean to the cache that keeps the removed url in the engines?

 
Magento Community Magento Community
Magento Community
Magento Community
 
tromanini
Jr. Member
 
Total Posts:  6
Joined:  2011-08-24
São Paulo
 

Hello I’m having the same problem in my store, but in my case is:

I configured magento options, so my URL is:

www.store.com.br/br/ - when I select Portuguese language and;
www.store.com.br/en/ - when I select English Language.

When I change the language at homepage all works good, but if I change my language after access any category or product, the URL rewrite not work, and I have a 404 page error.

Example:
I am in www.store.com.br/br/porcelana.html when I change to English I have this www.store.com.br/en/porcelain.html and works fine.

When I back to Portuguese I receive this www.store.com.br/br/porcelain.html but the correct is www.store.com.br/br/porcelana.html

This occur into categories and products, if I create the URLs manually in Rewrite Rules on Magento Panel all works. Is this a bug on Magento? Because not is created automatically.

Someone have any solution to automatically create the Rewrite Rules to categories and products?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
remiturcotte
Jr. Member
 
Total Posts:  4
Joined:  2012-02-14
 

I’ve found an ugly patch until a better approach comes up.

In the admin section, i’ve added the following javascript inside the wysiwyg in CMS > PAGES > (My 404 pages) (at the beginning of the wysiwyg) :

<script type="text/javascript" language="javascript">// <![CDATA[
var lang "en";
var 
rooturl "{{config path="web/unsecure/base_url"}}"
var url document.location.href;
if(!(
url.match("/"+lang+"/")))
{
  
var newUrl url.replace(rooturl rooturl+lang+"/" );
  
[removed].href newUrl;
}
// ]]></script>

(Note: you need to do this for all of your translated 404 pages. In each 404 page you need to modify lang="en” for your storeview url value)

Because the wysiwyg (tiny_mce) does not allow javascript to be threated, you’ll have to modify js/mage/adminhtml/wysiwyg/tinymce/setup.js. Add the following code under line 97 (under “var settings = “):

extended_valid_elements 'script[language|type|src]',

Here’s an example on my nepal arts website

 
Magento Community Magento Community
Magento Community
Magento Community
 
coolshot
Jr. Member
 
Total Posts:  9
Joined:  2012-03-30
 

Merci Remi, your solution works fine
I’d hope magento updates to allow a more elegant solution to be more seo friendly with multilanguage stores

Here’s my store:
http://www.vapers.fr

One last thing i am missing, is mutli language categories rewrites, which would be the top..

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top