Matching Directives

A number of other Apache directives make use of regular expressions. The following are the most common.

AliasMatch pattern file-path|directory-path

Map URLs to filesystem locations. Use submatch variables $1...$n to access submatches in the resulting file path.

<DirectoryMatch pattern> ... </DirectoryMatch>

Apply enclosed directives when filesystem directory matches pattern.

<FilesMatch pattern> ... </FilesMatch>

Apply enclosed directives when file matches pattern.

<LocationMatch pattern> ... </LocationMatch>

Apply enclosed directives when URL matches pattern.

<ProxyMatch pattern> ... </ProxyMatch>

Apply enclosed directives when URL matches pattern.

Get Regular Expression Pocket Reference, 2nd Edition 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.