Making a particular URL path case-insensitive

April 20th, 2009 by Steve Leave a reply »

I wanted to make the /execed path case-insensitive, so that /ExecEd, /Execed, /EXECED/, etc. would work. This requires a RewriteCond to prevent an infinite loop:

RewriteCond %{REQUEST_URI} !^/execed
RewriteRule ^/execed/?$ /execed/ [R=301,L,nocase]

Note that our server config is written out by Perl code. So escape the $ character if you want to avoid an hour of tearing your hair out wondering why this doesn’t work:

RewriteCond %{REQUEST_URI} !^/execed
RewriteRule ^/execed/?\$ /execed/ [R=301,L,nocase]
Advertisement

Leave a Reply

You must be logged in to post a comment.