Hello Would you please tell me any suggestion for a regular expression which includes any string starting with the string "categories/" that takes any string after "categories/" except car and boat? That is to say, examples of the strings in my pattern would be: "categories/" "categories/aaa" "categories/cat" "categories/car1" "categories/boat0" And examples of categories not in my pattern would be: "categories/car" "categories/boat" Thanks in advance
Use RewriteRule as you normally would. Then use RewriteCond along with the %{REQUEST_URI} variable to single out your two special cases. Something along these lines. RewriteCond %{REQUEST_URI} !car/?$ RewriteCond %{REQUEST_URI} !boat/?$ RewriteRule ^categories/(.*)$ Code (markup):
Thanks but I was looking for something to write it in just one RewriteRule, in case that was possible and something that did accept "car" or "boat" as words in the pattern.
Modern versions of Apache use Perl-compatible regular expressions with most if not all of the bells and whistles. Are you familiar with the snytax for Perl regex ? The only way you're going to do it with just one pattern is to use look-ahead/behind assertions. I'm not even sure those are part of the standard Perl regex library.
ok, it's ok. I am not familiar with Perl regex. But I just thought doing in one line would be more straightforward. It seems I am wrong though. So I will leave it as it is now. Thanks anyways. (SOLVED)