In Magento 1.7 and earlier versions, when you enable the “Add Store Code to Urls” feature in Configuration->Web panel there are two minor bugs that affect your web store.
- Changing language (store view) in frontend produce a 404 error
- Download links of product options file in backend does not work: redirect you to dashboard page
Solutions:
- Modify this file: /app/code/core/Mage/Core/Model/Url/Rewrite.php around line 252comment line:
// $targetUrl = $request->getBaseUrl(). '/' . $this->getRequestPath();
and substitute with this code:
if (Mage::getStoreConfig('web/url/use_store') && $storeCode = Mage::app()->getStore()->getCode()) { $targetUrl = $request->getBaseUrl(). '/' . Mage::app()->getStore()->getCode() . '/' . $this->getRequestPath(); } else $targetUrl = $request->getBaseUrl(). '/' . $this->getRequestPath();
- Modify this file: /app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php around line 526comment line:
//$this->_getOptionDownloadUrl($urlRoute, $urlParams),
and subsitute with this code:
str_replace("index.php/admin", ONE_OF_YOUR_STORE_CODE, $this->_getOptionDownloadUrl($urlRoute, $urlParams)),
January 13, 2013 at 12:59 am
Thanks man… It is also on my 1.7.0.2 version now this fixed it!
January 25, 2013 at 4:51 pm
I’m using Magento 1.7.0.2 and in my rewrite.php and file.php files I can’t find the code that we have to modify…
What can I do?
January 25, 2013 at 6:28 pm
Hi Carlos, you have to search the lines of code we posted without the two initial comment slashes
January 28, 2013 at 4:12 pm
Works like a charm in 1.7.0.2, only used the first solution. It is at line 252 in the file.
March 25, 2013 at 2:27 am
Worked like a charm! Wow thanks! Have this fixed this is recent builds?
May 20, 2013 at 3:05 pm
Worked perfectly. Thanks very much for sharing the solution.
June 18, 2013 at 4:09 pm
Looked for this solutions for days. Thanks! This is working great in Magento 1.7.0.2
October 23, 2013 at 11:28 am
Hello folks this is not working in Magento 1.8.0.0
Can someone please help???
Would I be able to downgrade to Magento 1.7.0.2 while my database is already live in 1.8.0.0. I have used another hack in languages.phtml to redirect to home page when language is changed instead of 404
This is a serious bug.
Although, it works if category/product name are same in both languages.
Thanks in Advance
June 5, 2014 at 6:23 pm
HI ,
I am not getting any chages with this code but i try to change index.php/admin with uk and i can’t get fault of my can you help me …!
August 5, 2015 at 10:58 pm
forntend and backend page does not show me
what is these link
pls help me