images

In Chapter 5, we talked about the RewriteCond directive and how you might use it to make rewrites conditional. In this chapter, you’ll see a variety of examples that use this functionality to accomplish a number of common tasks and a few not-so-common tasks.

One example was given in Chapter 5, and I’ll elaborate on that. Other examples were hinted at, and I’ll cover those in detail here.

Looping

Although looping was discussed in Chapter 5, it is worth mentioning again here, as it is perhaps the most common example of the use of conditional rewrites.

Many uses of mod_rewrite create conditions where the rewrite will loop. That is, the rewrite will ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.