<DirectoryMatch> directive

Description: Group directives that will be applied to specific file-system directory and sub-directories
Syntax: <DirectoryMatch regex> ... </DirectoryMatch>
Context: server config, virtual host

 

<DirectoryMatch> ... </DirectoryMatch> is used to enclose a group of directives which will apply only to the named file system directory and sub-directories. This directive is the same as <Directory ~> syntax.

Example:

<DirectoryMatch "^/www/(.+/)?[0-9]{3}">
   # ... directives here ...
</DirectoryMatch>


Don't forget to include RewriteEngine on directive in every <VirtualHost> tag or enclosed rules will not be applied.