Page 1 of 1

SEO: Return Correct HTTP Status Code When Site Is 'Offline'

Posted: Thu Dec 17, 2009 2:49 pm
by Peter Clements
As per my comments here:


When taking a Joomla! website offline (in the Global Configuration), the '200 OK' HTTP Status Code is returned. This is incorrect for a website that is 'down for maintenance' and, as a result, search engines could start to cache your offline message for every page of your website that it knows about.


Simple solution is some extra PHP code in offline.php in the System template (and all default templates) as follows:

Code: Select all

header('HTTP/1.1 503 Service Temporarily Unavailable',true,503);
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 86400');
This will return the '503 Service Temporarily Unavailable' status code, which is correct for a site in this state. You can also specify, in seconds, to crawlers how long to wait before trying to access the site again ('Retry-After').


Google Webmaster Central suggests that this is the correct method of telling Google about a site being in an 'offline' state:
http://googlewebmastercentral.[URL banned]. ... lebot.html
If my site is down for maintenance, how can I tell Googlebot to come back later rather than to index the "down for maintenance" page?
You should configure your server to return a status of 503 (network unavailable) rather than 200 (successful). That lets Googlebot know to try the pages again later.
And Google's definition of status codes also demonstrates that this is the correct status code for a site that's down for maintenance:
http://googlewebmastercentral.[URL banned]. ... lebot.html
503 (Service unavailable) The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.

Re: SEO: Return Correct HTTP Status Code When Site Is 'Offline'

Posted: Sat Jan 02, 2010 9:20 pm
by Bjorg
Should the Joomla! core contain a server, this may prove interesting…

Good luck!