Question

I have the following RewriteRule:

RewriteRule ^/people/([A-Za-z0-9\-\_]*)/?$  /people/people_details.cfm?person=$1 [I,L]

...it works great for forwarding my rule, but I want to make sure that the regex only picks it up if it has more than one character. So really, I need to have my regex...

[A-Za-z0-9\-\_]+

...have an additional rule to say that there has to be at least one character. Right now if I go to...

/people/

...it should go to the default document index.cfm, but because of the rule, it still tries to forward to my people_details.cfm

Any help?

Thanks, George

Was it helpful?

Solution

Your regular expression that you put in your question already ensures that there must be at least one character. The + means "1 or more", as opposed to * which means "zero or more". Just change the * to a +.

OTHER TIPS

...it should go to the default document index.cfm, but because of the rule, it still tries to forward to my people_details.cfm

Thats because you have the "/" as optional at the end, which is probably not what you wanted.

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