Apache <Files> and <FilesMatch> limited scope in httpd.conf

Since this syntax is not allowed:

<Files /path/to/the/file.php>
  Options +ExecCGI
</Files>

Is there a way to limit the scope of the directives <Files>and <FileMatch>in the httpd.conf so that it does not apply to subdirectories?

I tried:

<Directory /path/to/the>
  Options -ExecCGI
  <Files file.php>
    Options +ExecCGI
  </Files>
</Directory>

and with an additional rule:

<Directory /path/to/the/*>
  Options -ExecCGI
</Directory>

This, however, applies to all directories in transit.

An example of such a use would be to disable the default ExecCGI option and selectively select the selected files without having to use .htaccess files in each directory.

If you intend to consult using the .htaccess solution, do not respond.

EDIT: , 2.4 DirectoryMatch ( ), .

<DirectoryMatch "^/path/to/the$">
  Options -ExecCGI
  <Files file.php>
    Options +ExecCGI
  </Files>
</DirectoryMatch>
+3

All Articles