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

User avatar
Peter Clements
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 172
Joined: Tue Nov 08, 2005 12:58 pm
Location: Kent, England, UK

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

Post by Peter Clements » Thu Dec 17, 2009 2:49 pm

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.

User avatar
Joomla! Ace
Joomla! Ace
Posts: 1557
Joined: Tue Jul 07, 2009 4:45 am

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

Post by Bjorg » Sat Jan 02, 2010 9:20 pm

Should the Joomla! core contain a server, this may prove interesting…

Good luck!



Return to “Feature Requests - White Papers - Archived”