How can i replace 503 error page in Apache?

Discussion in 'Server Operation' started by ppawcio, Mar 19, 2010.

  1. ppawcio

    ppawcio New Member

    I run Linux RedHat and want to find out how can I replace the standard Apache 503 error page with my own? This is my configuration in the httpd.conf file for error pages. Can I just edit the HTTP_SERVICE_UNAVAILABLE.html.var in /var/www/error directory and replace the content with my own , or how can I accomplish my goal?


    Alias /error/ "/var/www/error/"

    <IfModule mod_negotiation.c>
    <IfModule mod_include.c>
    <Directory "/var/www/error">
    AllowOverride None
    Options IncludesNoExec
    AddOutputFilter Includes html
    AddHandler type-map var
    Order allow,deny
    Allow from all
    LanguagePriority en es de fr
    ForceLanguagePriority Prefer Fallback

    # ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
    # ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
    # ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
    # ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
    # ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
    # ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
    # ErrorDocument 410 /error/HTTP_GONE.html.var
    # ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
    # ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
    # ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
    # ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
    # ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
    # ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
    # ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
    # ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
    # ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    # ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

  2. falko

    falko Super Moderator ISPConfig Developer

    # ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    That directive is not active; I guess there's some other (active) ErrorDocument 503 directive somewhere in your Apache configuration. Yes, you can simply modify the file.
  3. dbrumbaugh

    dbrumbaugh New Member

    Modification of Error Docs

    The previous responder is correct, the directives are commented out because of the "#" in the directive statement. However, this doesn't mean that the directive is stated elsewhere in the config file. Not having a "ErrorDocument" in the config file then defaults to the error display provided by the browser used by the client.

    If you place the ErrorDocument xxx in Section 2 (Main Server) it will impact all sites on the server that do not include their own ErrorDocument within their <VirtualHost> directive section.

    To define error documents for a given domain. Place the ErrorDocumnet XXX directive inside of the <VistrualHost></VirtualHost> directive section for the domain.

    If you do not have access to the httpd.conf file, you may also place the directives in the .htaccess in your DocumentRoot directory. (assuming you have override capability)

    The second variable of the ErrorDocument directive can be what ever you need.


    ErrorDocument 500 http://<>/<path-to-file>
    ErrorDocument 500 /cgi-bin/
    ErrorDocument 500 "Sorry our equipment is broken"
    ErrorDocument 500 /<error_info_file>.html

    Caution: URLs that begin with a slash (/) or ./ specifies a local web-path relative to the DocumentRoot.

    There are special considerations for some error codes. For example,
    if you use an ErrorDocument 401 directive then it must refer to a local document. 401's are special.

    Hope this helps.

    "To error is human. Really mucking things up requires the root password."
  4. ppawcio

    ppawcio New Member

    I tried renaming the orignal error documents but it was not working. So what i actually did was this:

    # ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
    ErrorDocument 400 /error/include/400.html

    I simply added by own 400 html page to the include directory and it worked fine. Thanks all for your help again.

Share This Page