The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

confusion over serverwide errodocuments

Discussion in 'General Discussion' started by drsceifers, Aug 29, 2008.

  1. drsceifers

    drsceifers Member

    Aug 28, 2008
    Likes Received:
    Trophy Points:
    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?
  2. sneader

    sneader Well-Known Member

    Aug 21, 2003
    Likes Received:
    Trophy Points:
    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
    ErrorDocument 403
    ErrorDocument 404
    ErrorDocument 500
    ErrorDocument 501

    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

Share This Page