Name
<Directory> and <DirectoryMatch>
Synopsis
<Directory dir > ... </Directory>
The <Directory>
directive allows you to apply
other directives to a directory or a group of directories. It is
important to understand that dir
refers to
absolute directories, so that <Directory
/>
operates on the whole filesystem,
not the DocumentRoot
and
below. dir
can include
wildcards — that is, ?
to match a single
character, *
to match a sequence, and [
]
to enclose a range of characters. For instance,
[a-d]
means “any one of a, b, c,
d.” If the character ~
appears in
front of dir
, the name can consist of
complete regular expressions.[4]
<DirectoryMatch>
has the same effect as
<Directory ~ >
. That is, it expects a
regular expression. So, for instance, either:
<Directory ~ /[a-d].*>
or:
<DirectoryMatch /[a-d].*>
means “any directory name in the root directory that starts with a, b, c, or d.”
[4] See Mastering Regular Expressions, by Jeffrey E.F. Friedl (O’Reilly & Associates, 2002).
Get Apache: The Definitive Guide, 3rd 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.