Protecting Listings During Site Maintenance

A 503 Situation
If you run a popular website and it needs to be taken down for maintenance for a few hours you could lose your listings if a search engine robot comes to visit and the page is unavailable. You don’t want to send out a 404 page cannot be found error. This is obviously a worry, especially for large e-commerce sites, as any large site needs the occasional maintenance to update software or backup a large database.
Fortunately, there is something that can be done. The answer is the return code 503 to the search engines.
The code 503 means that website is down temporarily and that any search engines should come back later.
Using PHP it is easy to serve a 503 HTTP Header and with .htaccess we can tell the server when to use it.
The code is shown below:
PHP Header (errorpage503.php)
header(“HTTP/1.1 503 Service Temporarily Unavailable”);
header(“Status: 503 Service Temporarily Unavailable”);
header(“Retry-After: 3600″);
php?>
In this code the header is returned, the 3600 is the number of seconds before the search engine should come back and try again in an hour. To show this header under the correct circumstances, we need to modify the .htaccess file.
.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^.*google.* [NC]
RewriteRule .* /errorpage503.php
The first three lines are standard to switch mod_rewrite module on the business end of the code lies in the rewrite condition which says if the user agent is a Googlebot then show the errorpage503.php file. The NC flag at the end of the rewrite condition sets that the condition is case insensitive.
It is important to realise that this does not detect your site being down.You can comment the RewriteCond and RewriteRule lines of code in .htaccess files and uncomment them when you need to put the site on maintenance. Remember to comment them again when you have finished.
shipping containers here!!
Are you looking for a Large Mirror ? then come to us.
Drainage Maintenance made simple
Car transportation company
Click www.midnightmirrors.co.uk
Tags: Server codes, temporarily offline


![Validate my RSS feed [Valid RSS]](http://www.seothegame.com/wp-content/uploads/2008/11/valid-rss.png)