I have this nginx block that redirects all 401,403 and 404 to a single custom error page
error_page 401 @errorPage;
error_page 403 @errorPage;
error_page 404 @errorPage;
location @errorPage {
rewrite ^ /error.php?error=$status last;
}
Is it possible to deny the access to the error.php if called directly? Thanks
CodePudding user response:
Consider storing error pages outside of the main web folder and set a new root
or alias
:
location @errorPage {
root /var/www/error-pages;
...
}