htaccess file deny from all, redirects to 404 not found on 403.shtml but no custom error pages defined

Deadly 提交于 2019-12-04 15:32:29

This was not reproducible on a vanilla Apache installation so I started to further interrogate cPanel. So after plenty of mucking around I have tracked down the issue. cPanel does indeed set the ErrorDocument directive for you and it's not very clever at all. Especially when it sets the ErrorDocuments to documents that are visibly identical to the Apache defaults.
It's not obvious where this happens either as the ErrorDocument cPanel screen is blank.

cPanel's httpd.conf is built from quite a few included configs and tucked away there is...

/usr/local/apache/conf/includes/errordocument.conf
...
# 403 - Forbidden
ErrorDocument 403 /403.shtml

So there we go, that's where the 403.shtml is appearing in the request. cPanel's setting the error documents for me. To avoid the confusion of seeing the 404 on the 403 I've set my own 403 error message so at least they are consistent.

I hope this helps someone out!

Your htaccess file isn't causing the custom error page. If there isn't any other htaccess files, the problem probably lies with cPanel, which has its own way of setting custom error pages.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!