Convert to lowercase in a mod_rewrite rule.

Posted by dreeves on Stack Overflow See other posts from Stack Overflow or by dreeves
Published on 2010-05-27T18:09:30Z Indexed on 2010/05/27 18:11 UTC
Read the original article Hit count: 121

I would like URLs like server.com/foo to be case-insensitive. But server.com/foo actually gets mod_rewrite'd to server.com/somedir/foo

(Assume that all the files in "somedir" are lower case.)

So the question is, how to accomplish a mod_rewrite like the following:

RewriteRule  ^([^/]+)/?$  somedir/convert_to_lowercase($1)

© Stack Overflow or respective owner

Related posts about regex

Related posts about apache