Magento – Magento Enterprise Latest Edition Force Uppercase URL

url-rewrite

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?

Best Answer

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.