Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have my Apache configured like this:

<VirtualHost *:443>

    ServerAdmin webmaster@server.com

    ServerName www.server.com:443

    DocumentRoot /var/www/server/web

    SSLEngine on
    SSLCertificateFile /etc/ssl/crt/server.crt
    SSLCertificateKeyFile /etc/ssl/crt/server.key
    SSLCertificateChainFile /etc/ssl/crt/server.bundle

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !.(css|gif|jpg|png)$
    RewriteCond /var/www/maintenance -f
    RewriteCond %{SCRIPT_FILENAME} !maintenance.html
    RewriteRule ^.*$ /maintenance.html [R=503,L]

    <Directory "/var/www/server/web">

            ErrorDocument 503 default
            ErrorDocument 404 default

            RewriteBase /
            RewriteRule ^app_\.php$ - [L]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /app\.php [L]

    </Directory>

    LogLevel warn
    ErrorLog ${APACHE_LOG_DIR}/server.error.log
    CustomLog ${APACHE_LOG_DIR}/server.access.log combined

    ErrorDocument 503 /maintenance.html
    ErrorDocument 404 /error_404.html

 </VirtualHost>

The directive with the "maintenance" file works like a charm. But the 404 Rule does not work (Neither does a 500)

404 delivers the default 404-page:

Oops! An Error Occurred

The server returned a "404 Not Found".

Something is broken. Please e-mail us at [email] and let us know what you were doing when this error      occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

500 delivers a white page!

My code is based on Symfony2 if this matters.

I am trying around 3 hours now and I can not get it running. Thanks.

share|improve this question
    
That doesn't look like a default Apache 404 page. Do you have any other ErrorDocument directives in your config? (Anywhere in your onfig, not just in that particular vhost). If you triggered the 500 error by creating a Fatal error in PHP, a blank page is normal behaviour. You must catch PHP Fatal errors and handle them gracefully from within PHP. A 500 caused by an Apache config misconfiguration would use the ErrorDocument the way you expect. Also, I don't see an ErrorDocument 500 ... in your config. –  Ladadadada Oct 14 '13 at 16:46
    
Hey, thank you for your response. I have looked through all VHost Configs and haven't found anything. You are right there was no ErrorDocument 500 directive. I have added it an wrote a script which returned a 500 error but it did not work. The accesslog entry is GET /error.php HTTP/1.1 500 –  Dominik Kukacka Oct 15 '13 at 6:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.