对于503代码百度专门做了阐述和建议:如果站点临时关闭,当网页不能打开时,不要立即返回404,建议使用503状态。503可以告知百度spider该页面临时不可访问,请过段时间再重试。如果百度spider对您的站点抓取压力过大,请尽量不要使用404,同样建议返回503。这样百度spider会过段时间再来尝试抓取这个链接,如果那个时间站点空闲,那它就会被成功抓取了。

百度这里没有说过段时间是间隔多久,也没有说网站使用503返回码多长时间后百度不再抓取网页。我的建议还是在返回503状态码后还是尽快恢复访问,搜索引擎肯定不会有多大的耐性。
301重定向,404访问错误都好设置,那如何设置空间或者服务器让网页返回503状态码呢,我在网上找了一种php配合.htaccess文件的设置,有的空间可以直接在控制面板上面设置,除了这两种也许还有其他方法,没仔细找。
仅仅向google的蜘蛛发送HTTP503:
OptionsFollowSymLinks RewriteEngineOn RewriteBase/ RewriteCond%^.*(Googlebot|Googlebot|Mediapartners|Adsbot|Feedfetcher)-?(Google|Image)?[NC] #orRewriteCond%^.*google.*[NC] RewriteRule.*/cgi-bin/error/503.php
向除了指定ip外的任何来访者发送 503:
OptionsFollowSymLinks RewriteEngineOn RewriteBase/ RewriteCond%!^1\.1\.1\.1 RewriteCond%!^/cgi-bin/error/503\.php[NC] RewriteRule.*/cgi-bin/error/503.php
向蜘蛛发送 503,其他来访者返回一个 404 页面:
OptionsFollowSymLinks RewriteEngineOn RewriteBase/ RewriteCond%^.*(Googlebot|Googlebot|Mediapartners|Adsbot|Feedfetcher)-?(Google|Image)?[NC] RewriteCond%!^/cgi-bin/error/503\.php[NC] RewriteRule.*/cgi-bin/error/503.php RewriteCond%!^1\.1\.1\.1 RewriteCond%!^/cgi-bin/error/404\.php[NC] RewriteRule.*/under-development-explain.html[R=302,L]
PHP代码中返回 503:
<?php
ob_start();
header('HTTP/1.1503ServiceTemporarilyUnavailable');
header('Status:503ServiceTemporarilyUnavailable');
header('Retry-After:3600');
header('X-Powered-By:');
?>
<!DOCTYPEHTMLPUBLIC"-//IETF//DTDHTML2.0//EN">
<html><head>
<title>503ServiceTemporarilyUnavailable</title>
</head><body>
<h1>ServiceTemporarilyUnavailable</h1>
<p>Theserveristemporarilyunabletoserviceyour
requestduetomaintenancedowntimeorcapacity
problems.Pleasetryagainlater.</p>
</body></html>上面 .htaccess 里的 503.php 页面就可以直接使用上面的这段 php代码。
