当站点因维护而关闭时,发送的正确 HTTP 状态代码是什么?

发布于 2024-09-01 00:35:40 字数 275 浏览 3 评论 0原文

是否有 HTTP 状态代码告诉 Google(和其他人)走开,稍后再为我建立索引

基本上,是从语义上告诉客户该网站已关闭以进行维护的网站吗?

我考虑过的是

304 => Not modified
307 => Temporary redirect
410 => Gone
503 => Service Unavailable

我倾向于最后一个,但只是好奇哪一个是正确的选择。

Is there a HTTP status code to tell Google (and others) to go away, index me again later?

Basically, one that semantically tells clients that the site is down for maintenance?

The ones I have considered are

304 => Not modified
307 => Temporary redirect
410 => Gone
503 => Service Unavailable

I'm leaning towards the last one, but was just curious as to which one was proper choice.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

扮仙女 2024-09-08 00:35:40

HTTP 503 - 服务不可用 是最合适的。

由于服务器临时过载或维护,Web 服务器(运行网站)当前无法处理 HTTP 请求。言下之意是,这是暂时的情况,延迟一段时间后就会得到缓解。

Google 网站管理员中心论坛上的这篇文章也相关:

是的 - 503 是“我们已关闭”的正确服务器响应。如果您替换为“我们已关闭”的普通 HTML 页面并提供 200,则很可能会被 Google 编入索引。

如果您向 Googlebot 提供 503,它就会消失并稍后返回,而不会对您提供的内容建立索引。


更新:

至于 php 实现,您可能有兴趣查看以下文章:

另请注意 retry-after 标头,您可以在其中指定多少秒后应重新尝试另一个请求。

HTTP 503 - Service Unavailable would be the most appropriate.

The Web server (running the Web site) is currently unable to handle the HTTP request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay.

This post on the Google Webmaster Central Forum is also relevant:

Yes - a 503 is the correct server response for "We're closed". If you substitute a normal HTML page saying "We're closed" and serve a 200 it's very likely to get indexed by Google.

If you give the Googlebot a 503, it will just go away and come back later without indexing what you give it.


UPDATE:

As for the php implementation, you may be interested in checking out the following article:

Also notice the retry-after header, where you can specify after how many seconds another request should be re-attempted.

可是我不能没有你 2024-09-08 00:35:40

来自 http://www.google.com/ support/webmasters/bin/answer.py?hl=zh-CN&answer=40132

503(服务不可用) 服务器当前不可用(因为过载或停机维护)。一般来说,这是一种临时状态。

From http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=40132

503 (Service unavailable) The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.

躲猫猫 2024-09-08 00:35:40

我认为 503 是最合适的,因为 5xx 组通常用于处理服务器错误。

I'd consider the 503 to be most appropriate, since the 5xx-group is meant for server errors in general.

ゃ懵逼小萝莉 2024-09-08 00:35:40

503 服务不可用

503 Service Unavailable

你的笑 2024-09-08 00:35:40

503 Service Unavailable

as 5XX 系列属于服务器端问题

503 Service Unavailable

as 5XX series belongs to server-side issues

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文