title: How to catch Apache's 403 error in PHP / Kohana?
body: <p>My website is running on Kohana v3, and I have set up customized error page like below in bootstrap.php</p>
  
  <pre><code>try
  {
      // Attempt to execute the response
      $request-&gt;execute();
  }
  catch (Exception $e)
  { 
        .... error page re-direct.
  }
  </code></pre>
  
  <p>It works fine with 404 error.</p>
  
  <p>I also have some folders that cannot be directly accessed but they have to be located under the www root. I put the .htaccess to protect these folders</p>
  
  <pre><code># nobody can access this folder from Browser
  Deny from all
  </code></pre>
  
  <p>When user type in the URL in the browser to access files under this folder, an Apache 403 error will be shown in plain text like this:</p>
  
  <p>Forbidden</p>
  
  <p>You don't have permission to access /private_folder on this server.</p>
  
  <p>I want to customize this error and handle it in Kohana. However, I find that Apache fully controls the 403 error, and does not even call the index.php under this situation.</p>
  
  <p>Any idea to solve it?</p>