Changing the Database Connection Error Message

Basically, if you create a PHP file named db-error.php and put under /wp-content/, you’ll get what db-error.php will have. Here is my template on CodePen.

This is example :

<?php

    header('HTTP/1.1 503 Service Temporarily Unavailable');
    header('Status: 503 Service Temporarily Unavailable');
    header('Retry-After: 3600'); // 1 hour = 3600 seconds
    mail("[email protected]", "Database Error", "There is a problem with teh database!", "From: Example.COM");

?>
<!DOCTYPE HTML>
<html dir="ltr" lang="en-US">
    <head>
        <title>503 Service Temporarily Unavailable</title>
        <style type="text/css">
            h1, p {
                font-family: Helvetica, sans-serif;
                font-size: 24px;
                color: #333;
                }
            p {
                font-size: 14px;
                }
        </style>
    </head>
    <body>
        <h1>Uff, you came and our server started to sink!</h1>
        <p>You did nothing wrong. We are sad but our server's condition is just bad out of load. Please check back after sometime.</p>
    </body>
</html>

Leave a Comment