How to Create A Custom Apache 503 Error Page

snowfi6916 picture snowfi6916 · Feb 27, 2013 · Viewed 18.8k times · Source

I created an HTML document that will display that the server is not ready yet, and then redirect to another page. I want this to be the 503 error page.

What file do I need to edit in Apache to get this custom HTML to be my new 503 error page? I have tried following the instructions on multiple websites, but it still points to the original Apache one.

This is the code that I have in my "httpd-vhosts.conf" file.

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName blah.blah.com
ServerAlias blah blah.blah.local
ErrorLog "logs/blah-error.log"
CustomLog "logs/blah-access.log" common
ErrorDocument 503 "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/blah/error.html"
LogLevel warn
RewriteEngine On
JkMount /* worker5
DocumentRoot "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/blah"
<Directory "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/blah">
            Options All
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>
</VirtualHost>

In the "httpd.conf" file, it is including the "httpd-vhosts.conf" file, so I don't know why it is not working. Any help would be appreciated. Thanks.

Answer

Welsh picture Welsh · Oct 20, 2013

ErrorDocument takes in a absolute URL path instead of a file path. So it should be:

ErrorDocument 503 /blah/error.html

Assuming under your document root is a /blah/error.html file.