0

I was just facing the issue in Magento. If we use uppercase letters as request path.

Ex.

Request path: en-US/store-locator
Target path: stores/usa

Now if i try to open url as http://MY_SITE_BASE_URLS/en-US/store-locator/ then it doesn't redirect to Target URL.

But if i change uppercase to lowercase in request path

Ex.

Request path: en-us/store-locator
Target path: stores/usa

Now it works.

I have thousands of URL with uppercase in request path.

Any suggestion??

1

If no other solutions i get then i will end up with below solution

$rewrite_model = Mage::getModel('core/url_rewrite')->getCollection();
    foreach ($rewrite_model as $single_rewrite):
       if(preg_match('/[A-Z]/', $single_rewrite->getRequestPath())){
       $single_rewrite->setRequestPath(strtolower($single_rewrite->getRequestPath()))->save();
        }
    endforeach;    

This code will replace all request paths having uppercase letters into the lowercase letters.

  • Where do you add this code? – Nathan Jul 15 '16 at 2:55
  • You can create a test.php file in root directory Or add it in any phtml ex. header.phtml for one time – Akhil Gupta Jul 16 '16 at 14:10

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.