title: Restrict access to a directory by file type
body: <p>My Google-fu is failing me on this one...</p>
  
  <p>I'm trying to create an Apache config that will only allow access to image, js, and css files in a specific directory.</p>
  
  <p>For example, the following URL should work:</p>
  
  <p>mysite.com/dir/image.gif</p>
  
  <p>but this should be blocked:</p>
  
  <p>mysite.com/dir/page.php</p>
  
  <p>The part I'm struggling with is getting it working only for /dir/. The rest of the directories outside of /dir/ shouldn't be impacted by this directive.</p>
  
  <p>This is what I have so far, which isn't doing what I need (it seems to apply to all directories).</p>
  
  <pre><code>&lt;FilesMatch "\.(gif|jpe?g|jpg|png|js|css)$"&gt;
    Order deny,allow
    Allow from all
  &lt;/FilesMatch&gt;
  </code></pre>
  
  <p>How do I only allow access to certain file types within /dir/ but not affect the rest of my directories?</p>