Question

I want to direct my users based on a case-sensitive url:

www.mysite.com/a ==> page 1
www.mysite.com/A ==> page 2

I'm using the ISAPI rewrite with the following rule:

RewriteRule ^([0-9a-zA-Z] {1,7}) $/redirect/?K=$1 [L]

Apparently this rule is not case-sensitive, since it redirects to the same page. What's is wrong?

=====UPDATE=====

I solved in part this problem by adding a binary query (case-sensitive) in my MySql statement. But in chrome this problem still occurs.

Was it helpful?

Solution

I see 2 problems:

1) space between [] and {}

2) your regular expression is non-case sensitive

for lowercase expression you need RewriteRule ^([0-9a-z]{1,7}) $/redirect/?K=$1 [L] and for upper-case RewriteRule ^([0-9A-Z]{1,7}) $/redirect/?K=$1 [L]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top