Custom 403 Error page not showing

Posted by Rahul Sekhar on Server Fault See other posts from Server Fault or by Rahul Sekhar
Published on 2011-11-17T05:04:04Z Indexed on 2011/11/19 17:57 UTC
Read the original article Hit count: 397

Filed under:
|
|
|

I want to restrict access to certain folders (includes, xml and logs for example) and so I've given them 700 permissions, and all files within them 600 permissions. Firstly, is this the right approach to restrict access?

I have a .htaccess file in my root that handles rewriting and error documents. There are two pages in the root - 403.php and 404.php - for 403 and 404 errors. And I have these rules added to my .htaccess file:

ErrorDocument 404 /404.php
ErrorDocument 403 /403.php

Now, the 404 page works just fine. The 403 page does not show when I try to access the 'includes' folder - I get the standard apache 403 error page instead, saying 'Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.'

However, when I try going to the .htaccess file (in the web root) in my browser, I get my custom 403 error page. Why is this happening?

© Server Fault or respective owner

Related posts about apache2

Related posts about .htaccess