2

We are a new Magento Enterprise customer and have found the latest version of Magento Enterprise we are running on automatically converts our uppercase URLs indexed by Google to lowercase URLs creating for example: http://mysite.com.au/Riedel-O-Cabernet-Merlot-Buy-6-Get-8.html

Magento forces it to be: http://mysite.com.au/riedel-o-cabernet-merlot-buy-6-get-8.html

When we go live off our development server this week all our Google results will give 404.

Are you able to help us stop Magento from converting all URLs to a lower case?

2

I agree with Tim. It's generally good practice to avoid uppercase letters in URLs anyway. Luckily, if you're using Apache you should be able to use mod_rewrite to redirect all the the incoming uppercase URLs to lowercase versions by adding the following rules to your .htaccess file:

RewriteEngine On
RewriteMap  lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

This will handle the redirect before the request even gets to Magento. For any incoming request containing upper case letters, Apache will respond with a 301 redirect to the same URL but with all letters converted to lowercase. Here's a more in depth explanation of how this works: http://www.chrisabernethy.com/force-lower-case-urls-with-mod_rewrite/

4 lines the .htaccess file is much nicer than having to create 9500 redirect rules -- one for each url! After a while Google will remove the uppercase urls from it's index and replace them with the new lowercase urls. If you are using a different web server than Apache I'm sure there's a similar functionality available, but you'll have to do some more research.

  • Thank you, my concern is that Magento has already converted the upper case URLs to lower case. For example we loaded all 9,500 SKUs some time ago and found when we upgraded to the latest version that the URLs converted to lower case. Will your solution using Apache (which we have) still going to work now? – Carla Sep 8 '13 at 20:33
  • This solution looks very promising. – philwinkle Sep 8 '13 at 21:12
  • Only you can decide if this solution will work for you or not. What I'm suggesting is that you accept the fact that Magento has made your URLs all lowercase and use 301 redirects to avoid breaking old links and loosing search engine ranking. It's what I would do in your place as it seems easier than the alternative of figuring out how to prevent Magento from converting url keys to all lowercase. Here's another thread exploring the same issue. Doesn't sound too fun. – Zeke Farwell Sep 8 '13 at 21:47
  • I agree, and I think this is the right solution you have suggested. The problem is that when we do this in Apache we are having issues with our Magento store. For example admin stops working properly we cannot open our product category tree, the site becomes painfully slow and on the front end we get 404 errors on product pages. Any suggestions? – Carla Sep 9 '13 at 4:18
  • This is code: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} [A-Z] RewriteRule (.*) ${lc:$1} [R=301,L] RewriteRule ^api/rest api.php?type=rest [QSA,L] RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteCond %{REQUEST_METHOD} ^TRAC[EK] RewriteRule .* - [L,R=405] RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule .* index.php [L] </IfModule> – Carla Sep 9 '13 at 4:24
1

If the URL case conversion is only required for consistency of indexed Google URls then I would suggest not to modify Magento but add custom URL rewrites in Magento (Catalog \ Url Redirects) from Google cached type to Magento type.

Depending on the number of products you have you can do it either manually of write a bulk import script.

  • Thanks Tim, We have over 9,500 indexed URLs which have now converted to lower case from upper case. We tried to do a bulk import script, however Magento just converted them back to lower case within an hour. So you suggest we do the 301 redirects the Magento catalog? – Carla Sep 8 '13 at 7:01
  • Yes, right. After some time google will update the index and redirects could be removed. – user487772 Sep 8 '13 at 7:18
  • Do you have any suggestions on how we write this script redirecting all the lower case (magento generated) to the upper case (google indexed). Happy to pay you to write the scrip for us. – Carla Sep 8 '13 at 7:25

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.