Forum Moderators: phranque

Message Too Old, No Replies

.htaccess help UPPER case to lower

.htaccess help UPPER case to lower

         

scottpolk

5:35 pm on Feb 26, 2009 (gmt 0)

10+ Year Member



Hi:

I am attempting to rewrite and redirect all upper case request to lower case. I do not have access to HTTPD config and was wondering if there is another way to achieve this w/o using "RewriteMap"

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

Thanks
@scottpolk

jdMorgan

5:54 pm on Feb 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The code is included in the thread, A guide to fixing Google duplicate content & URL issues [webmasterworld.com] in our Forum Library.

Be aware that the code is complex and inefficient; Using a RewriteMap defined in httpd.conf (or similar config file) or sending all mis-cased URLs to your script and generating the case-correction redirect from within the script would be a better option.

You will need to read that post in its entirety, and extract the code very carefully to make it work; You'll need both the "set-up" part of the code (which gets several server-defined variables into user-defined variables), and the case-conversion routine itself.

Jim

scottpolk

5:58 pm on Feb 26, 2009 (gmt 0)

10+ Year Member



Jim

Thanks for pointing me to the thread ... I will go over it and give it a try