I have a folder named control which is contained in the root project folder named project, so the path on localhost forms like this for the control folder: http://localhost/project/control
In the control folder I put a .htaccess file that has the content:
RewriteEngine On
deny from all
At the project root folder i.e project folder i have another .htaccess file that contains the main code, including this 404 error redirection code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ errordocs/404.php [L]
Now what I want to do is that whenever 403 error is encountered when opening the control folder it should rewrite it to the same errordocs/404.php page.
You can match a statuscode with an output page with
ErrorDocument