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 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.