2
\$\begingroup\$

I redirect all my requests to index.php via htaccess and the code below is in my index.php.

I want to ask if my code is properly set for a custom 503 page for an unsuccessful MySQLi connection trial.

Is it also proper to use these metatags?

<meta name="robots" content="noindex,nofollow,noarchive">

<?php
$mysqli = new mysqli(HOSTX, USERX, PSWX, NAMEX);
if ($mysqli->connect_errno) {
    header($_SERVER["SERVER_PROTOCOL"]." 503 Service Unavailable");
    header( 'Content-Type: text/html; charset=utf-8' );
    header( 'Retry-After: 600' ); // 10 minutes
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="utf-8">
    <title>DB Connection Error</title>
    <meta name="description" content="DB Connection Error 503 sayfası" />
    <meta name="robots" content="noindex,nofollow,noarchive">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<p>DB Connection Error.</p><p>Please try in 1 or 2 minutes.</p>
</body>
</html>
<?php   
    exit();
}
?>
\$\endgroup\$
  • \$\begingroup\$ metatag ok -> check HTTP CODE ok -> check does it work? what else is there to review? \$\endgroup\$ – braunbaer Feb 11 '15 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.