title: Apache <Files> and <FilesMatch> restricted scope in httpd.conf
body: <p>Since this syntax is not allowed:</p>
  
  <pre><code>&lt;Files /path/to/the/file.php&gt;
    Options +ExecCGI
  &lt;/Files&gt;
  </code></pre>
  
  <p>Is there any way to restrict the scope of <code>&lt;Files&gt;</code> and <code>&lt;FileMatch&gt;</code> directives in httpd.conf
  so that it DOES NOT propagate to sub-directories?</p>
  
  <p>I have tried:</p>
  
  <pre><code>&lt;Directory /path/to/the&gt;
    Options -ExecCGI
    &lt;Files file.php&gt;
      Options +ExecCGI
    &lt;/Files&gt;
  &lt;/Directory&gt;
  </code></pre>
  
  <p>alone and with additional rule:</p>
  
  <pre><code>&lt;Directory /path/to/the/*&gt;
    Options -ExecCGI
  &lt;/Directory&gt;
  </code></pre>
  
  <p>This, however, propagates to all directories within the path.</p>
  
  <p>An example of such usage would be to disallow the ExecCGI option by default and allow it selectively to chosen files <strong>without</strong> the need to use of .htaccess files in each directory.</p>
  
  <p>If you are going to advise using .htaccess solution please do not reply.</p>
  
  <p><strong>EDIT:</strong> I was explained that since 2.4 it's possible to use the DirectoryMatch and the dollar mark syntax to handle this (an example below) but <strong>I haven't been able to make it work</strong>.</p>
  
  <pre><code>&lt;DirectoryMatch "^/path/to/the$"&gt;
    Options -ExecCGI
    &lt;Files file.php&gt;
      Options +ExecCGI
    &lt;/Files&gt;
  &lt;/DirectoryMatch&gt;
  </code></pre>