Exceptions and Special Cases

By now you’ve likely figured out that the RewriteCond directive can and ought to be used to handle a variety of exceptions and special cases when testing conditions and processing rules.

Although the RewriteCond can be used and treated much like a regular expression, this doesn’t always have to be the case.

It’s likely the most common use when evaluating conditions and processing rules with the .htaccess file.

Below are a few of the cases in which rewrite conditions can be evaluated and process:

As a side note, you can also place an exclamation mark (!) in front of each case to test the negative expression rather than the implicit positive expression.

For example, !-f would mean if the string is NOT a valid file.

For more information on Rewrite Condition directives, conditions, exceptions, and flags, visit the Apace website.