Importance of 503 status code Search Engines SEO
Server returns a 503 (service unavailable) status code when it is unable to handle the request due to a temporary overloading or maintenance of the server.
The effective implementation of this 503 status code can be used under the following circumstances,
- Website Maintenance: when you decided to down your website for maintenance passing this code to your users and search engines will be effective. This code tells search engines that the website is unable to serve the content but informs search engines that it has to come back later.
- Avoid Overloading: Let us take a typical example of an ecommerce website and during the holiday season they will have the maximum shopping, traffic and conversion so it is important to ensure that the website is at its best serving to users request. During this time you can stop search engines from taking up your bandwidth by passing them a 503 server status code which informs them to come back later. This will stop search engines indexing the website at busy times.
In case 1 you need to ensure that 503 status code is passed to search engines and users informing them on website maintenance where as in case 2 make sure you inform only to search engines and not users. The difficulty would be to recognize search engine crawlers and to only serve this result code when the server is actually under load – but it might be worth following up on if your server resources are limited.
Now let us see how we can implement the 503 server status code using .htaccess for the above cases,
Case 1: Passing 503 to Google and custom error pages for users
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^.*(Googlebot|Googlebot|Mediapartners|)-?(Google|Image)? [NC]
RewriteCond %{REQUEST_URI} !^/cgi-bin/error/503\.php [NC]
RewriteRule .* /503-error.php
RewriteCond %{REMOTE_HOST} !^1\.1\.1\.1
RewriteCond %{REQUEST_URI} !^/cgi-bin/error/404\.php [NC]
RewriteRule .* /maintenance.php [R=302,L]
Note: Make sure to inform users with a customized info on website maintenance through “maintenance.php”
Case 2: Passing 503 only to Googlebots
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^.*(Googlebot|Googlebot|Mediapartners|)-?(Google|Image)? [NC]
# or RewriteCond %{HTTP_USER_AGENT} ^.*google.* [NC]
RewriteRule .* /503-error.php

Thanks for Making Aware of this. Nice Post.
If I my site is in html and not php, does this mean that I have to use maintenance.html instead of maintenance.php for case 1.
The maintenance.html or .php is a page to inform the visitors on the website maintenance. The extension shouldn’t be an issue but I would suggest following uniformity in your web page extension
Thanks for clarification. But does maintenance.html page work if my site is in html and not in PHP.
Yes it does similar to our other HTML pages
Serving a different content, that's basically what you are suggesting, may be interpreted as cloacking, so nice article, but don't go with it just for search engines.
It isn't cloaking since it returns a 503 status code to both search engines and users.