title: Apache htaccess redirect all 404 (files and folders)
body: <p>I want to redirect to a PHP file all "404" errors. I used .htaccess from Wordpress as initial step. Works, but not when the path is a folder, means, had a "/" at end, I get a Forbidden error.</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /includes/redir.php [L]
  </code></pre>
  
  <p>If I try:</p>
  
  <pre><code>http://example.com/anything
  </code></pre>
  
  <p>works as expected, redirects to my redir.php. But if I try:</p>
  
  <pre><code>http://example.com/anything/
  </code></pre>
  
  <p>returns a Forbidden error.</p>
  
  <p>What I need to do to redirect to redir.php everything that don't exist?
  I need to change httpd.conf? I need a "ErrorDocument 404 /includes/redir.php" line?</p>