I redirect all my requests to index.php via htaccess and the code below is in my index.php.
Is this code 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();
}
?>
1 Answer 1
Is this code properly set for a custom 503 page for an unsuccessful MySQLi connection trial?
The code looks okay. One might argue that notifying the user that there was a database connection error is revealing too much information. For example, if a user attempted to take the system down with an attack vector like a Denial of Service attack then such an error message could be used to determine if the attack was successful.
The exit()
call may not be necessary, since it is at the end of the script.
Is it also proper to use these metatags?
It seems okay to use that meta tag for robots. Apparently sometime during the later months of 2024 the noarchive
rule has no longer been supported by Google.
The new text in Google’s help document reads:
"The noarchive rule is no longer used by Google Search to control whether a cached link is shown in search results, as the cached link feature no longer exists."
This move follows Google’s earlier decision to remove the cache: search operator, which was reported last week.