How to handle website downtime during site maintenance?

Downtime is obvious at times for all the sites. The time interval varies as well and sometimes it’s too short to even get noticed. However, there are occasions when it is mandatory to keep it under maintenance for more than expected period in order to let it fully function by making possible alterations. When it comes to the visitors, a.k.a. humans and search engine bots, they deserve to know the limit of halt that has been occurring.

In general, most people never return back if they find that a website couldn’t open after making a few attempts. As for Google bot or any other bot, the moment it notices that a lot of files are missing and there is nothing being displayed, it stops ranking it. This is because it too becomes clueless about its whereabouts or whether it would be coming back modified or not.

How to handle website downtime?

It is a logical approach to let everyone know in brief about the condition of your site. Additionally, it is important to not lose the image. Following are the common mistakes some website owners do:

1. Displaying a message on the URL – It is a fine technique to let the visitors know that the page is unavailable for a while and will be back after a few days, yet it fails to acknowledge the search engines as the developer hasn’t done the background coding. The search engines consider that web page (containing one statement explaining the problem in plain English or another native language) as permanent, thinking that it has no files present if each web page that existed is redirected to just one single page.

2. Removing all files from the server – If the requested page is not found and error 404 is displayed, it gives an impression that the search engines cannot really find out what is happening. People consider the web page as non-existent, and for bots too, it would be removed from the index because of the same reason. This is the worst-case scenario.

The HTTP status code determines the status of the server that hosts the website. For instance, 200 if the request succeeds, 301 if the location to redirect has been changed permanently, 302 lets the search engines know that it is temporary, and so on.

how to handle website downtime

Informing search engines that website downtime is temporary

We need to tell the search engine robots that the server is temporarily unavailable by using HTTP status code: 503 Service Unavailable. The developer first needs to create a file (possibly notepad or similar) with the name 503.php, write a few lines of code, and save it in the root of the server. The code must be written as under:

<?php

header(“HTTP/1.1 503 Service Temporarily Unavailable”);

header(“Status: 503 Service Temporarily Unavailable”);

header(“Retry-After: 7200”);

As one can see the first two lines clearly state the current status and the last line tells when the bot should visit it again to find it ready and up. It is either provided in terms of a specific date or a number that illustrates seconds, which is 7200 in the above case. The seconds can be replaced by something like this – Mon, 6 Jan 2012 13:00:00 GMT – and put it after “Retry-After:”. Make sure that the time you provide is in accordance with GMT/UTC.

The message that we have created is not enough as the visitors (search engines included) need to be redirected to this page to see this message. In an Apache or Linux server, the matter can be solved using a .htaccess file. This file is used for 301 redirects in general but can also be used for 302 redirects. In this particular case, we need 302, not 301. Write the following lines in .htaccess file and save it in the root of the server:

Options +FollowSymLinks

RewriteEngine On

RewriteBase /

RewriteCond %{REMOTE_ADDR} !^00\.00\.00\.00

RewriteCond %{REQUEST_URI} !^503.php [NC]

RewritwRule .* /503.php [R,L]

The ‘R’ in the last line is 302 redirect by default. If we were to indicate 301 redirect then it would have been [R=301,L]. This file lets us access the site and displays a 503 message for everyone else.

How to tell end users that the website is down only temporarily?

We need to make a few more additions to the 503.php file. Add the below lines after ?>

<!DOCTYPE html>

<html>

<head>

<title>Site temporarily unavailable</title>

</head>

<body>

<h1>Site is temporarily unavailable due to server maintenance</h1>

<p>We expect to have the site online again in 1 hour</p>

</body>

</html>

browser message site temporarily unavailable

This is the way how to handle website downtime and let both parties, end users and search engine bots, know the scenario during site maintenance.

(Visited 12 times, 1 visits today)

Leave a Reply