Search code examples
linuxapache.htaccesshttp-status-code-403

ErrorDocument 403 Not Working For Subdirectory


I have a structure like this on a shared host:

~/above_public_html/public_html/directory_i_want_forbidden

I have an ~/above_public_html/.htaccess with the following:

ErrorDocument 403 /403.html
ErrorDocument 404 /404.html

When I navigate to a file or folder that doesn't exist, I get the 404.html popping up, no problems.

When I navigate to a subfolder or file that exists but has chmod 700 permissions (including the directory_i_want_forbidden), I get:

Forbidden

You don't have permission to access /directory_i_want_forbidden on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at www.mydomain.com Port 80

What do I need to do in order to make the ErrorDocument 403 /403.html work correctly?


Solution

  • Something was screwy with the .htaccess or httpd.conf upstream. I had no control over it since I was on shared hosting. I have since started my own Amazon EC2 server-instance and everything is working as it should.