title: How do you have a custom 401 Unauthorized Page through htaccess
body: <p>So I have a Password Protected Localhost Server to prevent these unknown IPs from getting in my server. </p>
  
  <p>What I want to do is as soon as they try logging in and they get a 401 error htaccess sends them to a file called block.php</p>
  
  <p>as so: ErrorDocument 401 /block.php</p>
  
  <p>The problem is though, because they are not authorized to view anything on that site, block.php does not get called at all.</p>
  
  <p>How do I work around this?</p>
  
  <p>My httaccess looks like this:</p>
  
  <pre><code>   AuthType Basic
     AuthName "C:\\xampp\\htdocs"
     AuthUserFile C:\\xampp\\htdocs/.htpasswd
     Require valid-user
  
    &lt;FilesMatch block.php&gt;
    Order Deny,Allow
  
    &lt;/FilesMatch&gt;
  
   ErrorDocument 401 /block.php
   ErrorDocument 400 /block.php
   ErrorDocument 403 /block.php
  
  
  
   ############### START BANS ###############
  </code></pre>