title: Problem redirecting 403 Forbidden to 404 Not Found
body: <p>The pertinent part of my .htaccess looks like this:</p>
  
  <pre><code>Options -Indexes
  &lt;FilesMatch include&gt;
      Order allow,deny
      Deny from all
  &lt;/FilesMatch&gt;
  RedirectMatch 404 ^/include(/.*)$
  </code></pre>
  
  <p>And it's generating the following responses:</p>
  
  <ul>
  <li>/include 403  </li>
  <li>/include/ 404  </li>
  <li>/include/config.inc 403  </li>
  </ul>
  
  <p>I can tell by looking at my pattern that problem is likely in the (/.*) part but everything I have tried gives me the same results; instead of consistently getting 404 I get a 404 for the one case and 403 for everything else. <strong>What is wrong with the expression I'm using? Alternatively since I have to do this for a few directories is there a blanket approach that would allow me to convert all 403 responses to 404?</strong></p>
  
  <p><strong>UPDATE:</strong> I've found that by removing the FileMatch I get better results, so my .htaccess now looks like this:</p>
  
  <pre><code>Options -Indexes
  RedirectMatch 404 ^/include(/.*)?$ # Added dlamblin's first suggestion
  </code></pre>
  
  <p>And generates the following responses:</p>
  
  <ul>
  <li>/include 404  </li>
  <li>/include/ 404  </li>
  <li>/include/config.inc 403</li>
  </ul>
  
  <p><strong>UPDATE:</strong> Interestingly enough I have discovered that the following produces different output:</p>
  
  <pre><code>RedirectMatch 404 ^/include(/?|/.*)$
  RedirectMatch 404 ^/template(/?|/.*)$
  </code></pre>
  
  <p>The template pattern works on all cases however include is still generating 403 for all files in include (e.g. /include/config.inc) <strong>Could this be an issue with the directory name and not a problem with the .htaccess file itself?</strong></p>
  
  <p><strong>UPDATE:</strong> The following in my .htaccess was conflicting with redirect when accessing /include/config.inc.</p>
  
  <pre><code>&lt;FilesMatch config&gt;
      Order allow,deny
      Deny from all
  &lt;/FilesMatch&gt;
  </code></pre>