SEO Friendly Your Site's Downtime

Closing your site down temporarily for maintenance and so to make changes to it must be handled with a level of care if you are to avoid confusing either your site's visitors or crawling search spiders; looking to index your content. If either type in your site's address or click on a link from another site, and reach a 404 error (“this page does not exist”) screen, it is likely that they will either leave or fail to link back to whatever content they were looking for. Both end results are bad practice and ought to be avoided.

So in an ideal world you would send a message to both search spiders and human visitors, indicating that the site is down for maintenance and that both are to expect it back up in a certain amount of time. You'll be glad to know, both are possible.

Status Code Info Graphic
Status Code Info Graphic | Source

Status Codes

When a browser or searching spider attempt to visit a website they send a request to that servers where that site is found for the content to display. In response to that request, the server sends a status code, indicating whether your request has been successful or not (also helpfully identifying why not if it is not found). Using status codes you can indicate why a site is not being found and both permanently and temporarily redirect the requesting party to another address. Attached is an info graphic indicating some useful status codes.

503.php

As you may have seen from the helpful info graphic on status codes above, a 503 status code indicates that the site is temporarily down for maintenance. This indication is helpful in that it allows to communicate to searching spiders that the information that is seeking is only temporarily unavailable and will be back soon.

In order to create such a status code, you need to create a file entitled 503.php and include the following code:

<?php
header("Http/1.1 503 Service temporarily Unavailable");
header(Status: 503 Service Temporarily Unavailable");
header ("Retry-After:Set-Amount-of-Time)
?>
<!DOCTYPE html?
<HTML>
<HEAD>
<Title> Site down for maintenance</Title>
</HEADH>
<BODY>
<H1>Site is Temporarily Down for Maintenance; We Apologise For Any Inconveniance</H2>
<p>We sincerely apologise, however the site is temporarily down for maintenance.</p>
<p> The site will be available again one hour from 12pm GMT</p>
</Body>
</HTML>

...This file is to reside in the root directory. Remember to replace “Set-Amount-of-Time” with the duration of expected downtime in either seconds (3600) or the exact time and date (“...Mon, 15 Jan 2012 9:00 GMT”)

.HTACCESS

Now we must instruct all requests, coming from every link previously found on the domain, to redirected to this new page. In order to do so, you must locate and insert a few lines of code in to your .hatccess file. This typically lives in your root folder however it can be the case that your site has several, in which case you will need to amend all files. Once you have located this file you will want to insert the following code:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{Remote_ADDR} !^Enter\.your\.IP\.Here
RewriteCond %{Request_URI} !^/503.php [NC]
RewriteRule .* /503.php [R,L]

Take care to replace !^Enter\.your\.IP\.Here with your IP Address (for example !^36\.435\.534\.23), so to permit yourself access and avoid the redirect.

So There You Have It...

At this point you have successfully taken your site down for maintenance, ensuring that both humans and search bots alike recognise that this is not permanent and merely a result of maintenance work.


Comments 1 comment

Rob Winters profile image

Rob Winters 4 years ago

Very informative and useful hub topic.I don't think i've seen anyone else cover this and yet many have probably suffered from not being aware of this.Up & Useful & Bookmarked :-)

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working