Mod Rewrite URL to lowercase

Hi guys,
I just wanted to ask how to go about modifying this code so that my URLs are rewritten in lowercase?

At the moment Ive got a mixture of uppercase and lowercase in my URLs and I believe its causing indexation issues.

Heres the code…

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ articles_view_article.php?permalink=$1
RewriteCond %{REQUEST_URI} rss.xml
RewriteRule (.*) rss.php

Thanks :slight_smile:

Cpradio…thanks for the link but thats all jibberish to me. My background is ASP. Im totally lost here, and really need someone to place the code in for me, if possible.


Place this in your htaccess

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

And this in your httpd.conf

RewriteMap  lc int:tolower

*shrug …

No idea. I got some crazy ‘Access Forbidden’ error???

that has to do with permissons, chmod every thing you want world wide vieable to 755

Did you get the error when you put the RewriteMap inside the .htaccess file? That was how I originally posted it, but then I changed it to reflect that it should be put in the httpd.conf


The %{lc:} arguement is for lowercase and is part of the RewriteMap function … which can only be setup in a configuration file (httpd.conf or Apache2.conf are the server configuration files for Apache).

If you’re not using Apache, you’ll need to wait for a M$ guy (like Wyatt - wwb_99) to come along. mod_rewrite’s been translated to M$ so most functionality works with IIS but …

You could use a series of 26 RewriteRule statements to do that but that’s ridiculous (to correct capitalization problems). mod_speling will correct capitalization for you as well as one or two typos so get that enabled on an Apache server and you’ll be set without doing any funky programming.