I found this rule which works fine with just one condition which is: foobar
is in the string.
I need to change this to include a new condition to have two conditions (instead of one):
-
foobar
is in the string. This is already working. -
meetball
is NOT in the string.RewriteRule ^(.*)foobar(.*)$ http://www.example.com/index.php [L,R=301]
2
Answers
Please try following, written as per your shown samples. Also you need to create groups
(.*)
since you are not using them while redirection. You could addNC
flag of apache to enable ignorecase to the URI values.OR without negative lookahead try with usual condition check. Please make sure either you put above Rulesets OR following rulesets one at a time only.
You can use negative lookahead pattern:
(?!.*meetball)
will fail the pattern match ifmeatball
is found anywhere in URI. Also there is no need to use grouping hence(...)
is removed in my answer.