When discussing the RewriteRule directive, we have already encountered several situations in which it would have been nice to be able to apply a condition on the rewrite. Indeed, several of the examples in Chapter 4 were a little hokey, specifically because we were unable to apply any conditions. By “conditions,” I mean that we only want to do a particular rewrite under certain circumstances. The RewriteCond directive supplies this ability and may be used before a RewriteRule to impose such a condition on the execution of that rule.

In this chapter, I’ll introduce the syntax and use of the directive, and then give a number of examples that illustrate ...

Get The Definitive Guide to Apache mod_rewrite now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.