2

currently I use a multi-language store setup with Magento 1.7 on a single domain. The URLs looks like this:

www.example.com/category/product.html
www.example.com/kategorie/produkt.html

For SEO reasons I want to use storecodes:

www.example.com/en/category/product.html
www.example.com/de/kategorie/produkt.html

Problem: The old structure is fully indexed by google. I don't know how to rewrite those URLs correctly to the right storecode. Any ideas?

Thanks in advance

  • please explain how it problem your question – Ashvin Monpara Jun 27 '15 at 3:31
2

Set your store url to have code System > Config > Web > Add Store Code to URLs

And make sure you add your desired store code Follow these steps:

Go to System > Manage Store and edit each store then add your code in code section.

Then add all old url to redirect to new url by editing directly from database.

The table that is responsible for rewrite is core_url_rewrite.

In that table you will be focusing on these columns

  1. store_id
  2. request_path

Store id is the id for your store. So you want to find out what is the id for en and de.

Now, export core_url_rewrite in csv format and make backup of this file then edit request path sections and put your all old url in target path section as desired.

I am sure you can differentiate your request path by looking at their store_id.

After complete edit of that file, upload your csv file into that. You should update url_rewirte_id as well, since they are set to auto increment. Your first url_rewrite_id should be greater than last entry on that table and should be in increment basis.

  • Thanks for your reply Adarsh! Editing the core_url_rewrite table is an interesting idea. But I don't know how changing the request_path can help in this case. The request_path is identical, regardless of whether I use the storecode in the url or not. In my understanding, the storecode is part of the language base url. – spakus Jun 27 '15 at 9:24
  • Check my updated answer, I think I had misunderstood your question. – Adarsh Khatri Jun 27 '15 at 9:51
  • Yes, I know the store code option. But exactly this leads to the problem, because magento won't redirect automatically. E.g. A product has the URL www.example.com/category/product.html for the english version of the product and www.example.com/kategorie/produkt.html for the german one. These two URLs are indexed by Google. When I enable the "Add Store Code to URLs" option, the store code will add to the URLs: www.example.com/en/category/product.html and www.example.com/de/kategorie/produkt.html. The old URLs no longer work now. I won't redirect 500 products manually in the htaccess. :) – spakus Jun 27 '15 at 10:05
  • That's exactly where you can add more url redirect in database. I have updated my qst again. Please have a look. – Adarsh Khatri Jun 27 '15 at 10:14
  • So basically you are adding new list of redirect, putting all old url in target section and new with store code url in request section. – Adarsh Khatri Jun 27 '15 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.