images

The RewriteMap directive lets you call on something external to help you do your rewriting. This can be a program, a database, or simply a file that lists the mappings. In this chapter, you’ll learn how to use this directive, and you’ll see a number of useful examples of the directive in action.

RewriteMap Syntax

The RewriteMap directive allows you to create a “function” that may be used later in RewriteCond and RewriteRule directives. The syntax of the function is as follows:

RewriteMap mapname maptype:maplocation

Once defined, this map may be used in any RewriteCond or RewriteRule directive:

RewriteRule (.*) ${mapname:$1| default}

The ...

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.