Apache Reference: mod_rewrite, RewriteCond

RewriteCond

Rewrite Condition
Syntax: RewriteCond test-string pattern [[flag,...]]
Example: RewriteCond %{HTTP_HOST} ^.+\.foo\.dom$
Since: Apache 1.2

This directive defines a rewriting rule condition. A RewriteRule directive can be preceded with one or more RewriteCond directives. The RewriteRule is then used only if its pattern matches the current state of the URL and the preceding conditions apply. The test-string can contain the following (to be expanded) constructs in addition to plain text: rule pattern back-references ($N, N = 1,2,...), condition pattern back-references (%N, N = 1,2,...), or server variables (%{NAME}). The pattern is the condition pattern that is, a regular expression that is applied to the instance of the test-string. In other words, test-string is evaluated and then compared with pattern. Special patterns and additional flags also exist. For more details, see the mod_rewrite online documentation.