Prevent setup-config.php page from appearing when host blocks database

It’s not completely clear how your provider is handling the the resource overage, but the situation described in the question can be reproduced by setting up wp-config.php to connect to an empty database. From the looks of it, someone would be able to proceed with the WordPress installation.

This solution will prevent WordPress from being reinstalled.

Add the following line to your .htaccess file to prevent access to the WordPress installation scripts:

RedirectMatch Permanent wp-admin/install(-helper)?\.php /site-unavailable.html

Create the file site-unavailable.html in the site’s root directory and add message stating that the site is currently unavailable:

<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>Site temporarily unavailable</title>
    <meta name="robots" content="noindex,follow">
    <style type="text/css" media="screen">
        body { font-size: 16px; }
    </style>
</head>
<body>
    <article>
        <p>Our site is experiencing a high volume of traffic and will return soon.</p>
    </article>
</body>

This will redirect any attempts to load the install files wp-admin/install.php and wp-admin/install-helper.php to http://domain.com/site-unavailable.html.

Leave a Comment