I was having issues getting this working 2 years ago and through posting in here, got it resolved...

Now I have another related question to the same rewrite code...

I haven't ever run into this issue til now, so didn't realize it existed...

I need the rewrite rule to be case insensative... so any combination of the letters whether capitals or lower case will yield the same results...

I thought that is what the NC was supposed to do in the 3rd line, but it doesn't.

From Apache.org
Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner. That is, it doesn't care whether letters appear as upper-case or lower-case in the matched URI.

Any suggestions on how to make that happen?

Here is the code I use now.

php_value session.gc_maxlifetime 14400
RewriteEngine On
RewriteRule ^([a-z0-9]+)$ /index.php?m=$1 [NC,L] # captures member username no case last rule
ErrorDocument 404 http://www.domainname.com/contactsupport.php 

Thanks in advance for any feedback.

Edited by showman13: add quote from apache

5 Years
Discussion Span
Last Post by showman13

I did try that earlier thinking the same thing, but it had no effect at all.



You know it would be nice if you post the previous thread that was 2 years ago...

But I post it here:


The correct URL is this:

rewriteRule ^([a-zA-Z0-9_-]+)$ index.php?m=$1

But 2 years later your code is this:

RewriteRule ^([a-z0-9]+)$ /index.php?m=$1 

Technically, it shouldn't change much at all but it seems you change it a bit.

It's a bit fishy that you did a 180 degree with the code from 2 years ago.

Edited by LastMitch: grammer



I did try that earlier thinking the same thing, but it had no effect at all.


It does look right.

Edited by LastMitch: grammer



Fishy or not, it makes no difference with or without the A-Z in the options, and doesn't seem to make a difference whether the / is in front of the index.php or not.

it is just perplexing to me that even with the NC, it is still case sensative.

Hopefully someone will have a clue, because I don't.



I'm trying to understand what this is trying to do. So


Will be picked up as

$_GET['m'] ( = sOmeUserNaMe)

So what's the problem with this? Or is it redirecting 404 anyway?


Just for information, the NC flag in an htaccess does not convert uppercase letters to lowercase, it's to specify that you will allow both uppercase and lowercase letters. So if you point to an image like this "image.jpg" or "image.JPG", they will still point to the same image. But if it's for a $_GET variable like you have (index.php?m=$1) it will be uppercase and lowercase. What you should do on the index.php page, is take the $_GET variable and use a function to make all the letters lowercase before your code processes the variable. You should also remove the NC flag.

Edited by coreyavis


Hmmm, strange... I responded to this about a week ago but for some reason it didn't get recorded... Maybe I forgot to hit the reply button... DUH...

Anyway, thank you all for your responses. That is interesting on the NC flag being something totally different than I thought it was...

As it turns out, it wasn't the ?m=$1 that was causing the problem, but actually the comparison that I was doing after the fact. Once I removed the comparison, the issue went away. Amazing how I can create my own problems sometimes...

thanks again for the feedback, this is my favorite place for answers to my questions, In fact I have another question coming up in another category...


This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.