Last Updated: October 07, 2020
·
2.769K
· ekrembk

Maintenance header for SEO with PHP

No need for a detailed explanation. When your website is under construction, tell search engines to come back later. That's where we need 503. Here is the codes:

header( ( $_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1' ? 'HTTP/1.1' : 'HTTP/1.0' ) . ' 503 Service Unavailable', true, 503 );
header( "Retry-After: 3600" );

3600 is the number of seconds for search engines to come back later.

1 Response
Add your response

If anyone want to be sure that Google respects 503 status code, you should check this link http://googlewebmastercentral.blogspot.com/2006/08/all-about-googlebot.html

over 1 year ago ·