confusion over serverwide errodocuments

drsceifers

Member
Aug 28, 2008
9
0
51
According to some posts I have found, we should be able to establish a global errordocument that holds across cpanel/easyapache rebuilds of the http.conf file.

I read that modifying the file /usr/local/cpanel/APACHE_CONFIG and setting the ErroDocument 404 /home/CustErr/404.shtml should always build an httpd.conf using these values. But, the cpanel admin we are using says this is dangerous and won't work the way we expect.

my Question: Does cpanel break apache this much? He says it does and the only way to do what we want is to use .htaccess overrides, but our customer can delete this & they go back to an ugly 404 page.

I cannot find a definitive answer on the boards or when I RT_M. Can anyone help?
 

sneader

Well-Known Member
Aug 21, 2003
1,195
64
178
La Crosse, WI
cPanel Access Level
Root Administrator
Your mileage may vary, but I solved this problem with a simple solution.

In the server's /home directory (where all your customers have their home directories), I created an .htaccess file, and put this inside:

ErrorDocument 400 http://hostname.example.com/error/400.htm
ErrorDocument 403 http://hostname.example.com/error/403.htm
ErrorDocument 404 http://hostname.example.com/error/404.htm
ErrorDocument 500 http://hostname.example.com/error/500.htm
ErrorDocument 501 http://hostname.example.com/error/501.htm

Then, I created an /error directory in /etc/httpd/htdocs, and put up the referenced error documents.

Seems to work, although I think a 403 error requested a relative URL, so my solution is probably not working for 403's -- but 99% of the errors are 404 anyway.

If the customer creates their own custom error pages using .htaccess, then it overrides my global error pages.

Seems to work pretty slick.

- Scott