转:https://support.google.com/webmasters/answer/40132
在网站建设的实际应用中,容易出现很多小小的失误,就像mysql当初优化不到位,影响整体网站的浏览效果一样,其实,网站的常规http状态码的表现也是一样,Google无法验证网站几种解决办法,提及到由于404状态页面设置不正常,导致了google管理员工具无法验证的情况,当然,影响的不仅仅是这一方面,影响的更是网站的整体浏览效果。因此,比较清楚详细的了解http状态码的具体含义,对于一个网站站长来说,这是很有必要俱备的网站制作基础条件。
如果某项请求发送到您的服务器要求显示您网站上的某个网页(例如,用户通过浏览器访问您的网页或 Googlebot抓取网页时),服务器将会返回 HTTP 状态码响应请求。
此状态码提供关于请求状态的信息,告诉 Googlebot 关于您的网站和请求的网页的信息。
一些常见的状态码为:
- 200 – 服务器成功返回网页
- 404 – 请求的网页不存在
- 503 – 服务器临时不可用
下面是 HTTP 状态码的完整列表。您也可以访问 HTTP 状态码上的 W3C 页获取更多信息。
1xx(临时响应)
表示临时响应并需要请求者继续执行操作的状态码。
100(继续) | 请求者应当继续提出请求。服务器返回此代码表示已收到请求的第一部分,正在等待其余部分。 |
101(切换协议) | 请求者已要求服务器切换协议,服务器已确认并准备切换。 |
2xx (成功)
状态码表明服务器成功处理了请求。
200(成功) | 服务器已成功处理了请求。通常,这表示服务器提供了请求的网页。如果是对您的robots.txt 文件显示此状态码,则表示 Googlebot 已成功检索到该文件。 | |
201(已创建) | 请求成功并且服务器创建了新的资源。 | |
202(已接受) | 服务器已接受请求,但尚未处理。 | |
203(非授权信息) | 服务器已成功处理了请求,但返回的信息可能来自另一来源。 | |
204(无内容) | 服务器成功处理了请求,但没有返回任何内容。 | |
205(重置内容) | 服务器成功处理了请求,但没有返回任何内容。与 204响应不同,此响应要求请求者重置文档视图(例如,清除表单内容以输入新内容)。 | |
206(部分内容) | 服务器成功处理了部分 GET 请求。 |
3xx (重定向)
要完成请求,需要进一步操作。通常,这些状态码用来重定向。Google 建议您在每次请求中使用重定向不要超过 5次。您可以使用网站管理员工具查看一下 Googlebot在抓取重定向网页时是否遇到问题。诊断下的网络抓取页列出了由于重定向错误导致Googlebot 无法抓取的网址。
300(多种选择) | 针对请求,服务器可执行多种操作。服务器可根据请求者 (user agent)选择一项操作,或提供操作列表供请求者选择。 |
301(永久移动) | 请求的网页已永久移动到新位置。服务器返回此响应(对 GET 或 HEAD请求的响应)时,会自动将请求者转到新位置。您应使用此代码告诉 Googlebot 某个网页或网站已永久移动到新位置。 |
302(临时移动) | 服务器目前从不同位置的网页响应请求,但请求者应继续使用原有位置来响应以后的请求。此代码与响应 GET 和 HEAD 请求的301 代码类似,会自动将请求者转到不同的位置,但您不应使用此代码来告诉 Googlebot 某个网页或网站已经移动,因为Googlebot 会继续抓取原有位置并编制索引。 |
303(查看其他位置) | 请求者应当对不同的位置使用单独的 GET 请求来检索响应时,服务器返回此代码。对于除 HEAD之外的所有请求,服务器会自动转到其他位置。 |
304(未修改) | 自从上次请求后,请求的网页未修改过。服务器返回此响应时,不会返回网页内容。 如果网页自请求者上次请求后再也没有更改过,您应将服务器配置为返回此响应(称为 If-Modified-Since HTTP标头)。服务器可以告诉 Googlebot 自从上次抓取后网页没有变更,进而节省带宽和开销。
|
305(使用代理) | 请求者只能使用代理访问请求的网页。如果服务器返回此响应,还表示请求者应使用代理。 |
307(临时重定向) | 服务器目前从不同位置的网页响应请求,但请求者应继续使用原有位置来响应以后的请求。此代码与响应 GET 和 HEAD 请求的<ahref=answer.py?answer=>301</a>代码类似,会自动将请求者转到不同的位置,但您不应使用此代码来告诉 Googlebot 某个页面或网站已经移动,因为 Googlebot会继续抓取原有位置并编制索引。 |
4xx(请求错误)
这些状态码表示请求可能出错,妨碍了服务器的处理。
400(错误请求) | 服务器不理解请求的语法。 |
401(未授权) | 请求要求身份验证。对于登录后请求的网页,服务器可能返回此响应。 |
403(禁止) | 服务器拒绝请求。如果您在 Googlebot 尝试抓取您网站上的有效网页时看到此状态码(您可以在 Google网站管理员工具诊断下的网络抓取页面上看到此信息),可能是您的服务器或主机拒绝了Googlebot 访问。 |
404(未找到) | 服务器找不到请求的网页。例如,对于服务器上不存在的网页经常会返回此代码。 如果您的网站上没有 robots.txt 文件,而您在 Google 网站管理员工具“诊断”标签的robots.txt 页上看到此状态码,则这是正确的状态码。但是,如果您有 robots.txt文件而又看到此状态码,则说明您的 robots.txt 文件可能命名错误或位于错误的位置(该文件应当位于顶级域,名为robots.txt)。 如果对于 Googlebot 抓取的网址看到此状态码(在”诊断”标签的 HTTP 错误页面上),则表示 Googlebot跟随的可能是另一个页面的无效链接(是旧链接或输入有误的链接)。 |
405(方法禁用) | 禁用请求中指定的方法。 |
406(不接受) | 无法使用请求的内容特性响应请求的网页。 |
407(需要代理授权) | 此状态码与 <ahref=answer.py?answer=35128>401(未授权)</a>类似,但指定请求者应当授权使用代理。如果服务器返回此响应,还表示请求者应当使用代理。 |
408(请求超时) | 服务器等候请求时发生超时。 |
409(冲突) | 服务器在完成请求时发生冲突。服务器必须在响应中包含有关冲突的信息。服务器在响应与前一个请求相冲突的 PUT请求时可能会返回此代码,以及两个请求的差异列表。 |
410(已删除) | 如果请求的资源已永久删除,服务器就会返回此响应。该代码与404(未找到)代码类似,但在资源以前存在而现在不存在的情况下,有时会用来替代 404 代码。如果资源已永久移动,您应使用 301指定资源的新位置。 |
411(需要有效长度) | 服务器不接受不含有效内容长度标头字段的请求。 |
412(未满足前提条件) | 服务器未满足请求者在请求中设置的其中一个前提条件。 |
413(请求实体过大) | 服务器无法处理请求,因为请求实体过大,超出服务器的处理能力。 |
414(请求的 URI 过长) | 请求的 URI(通常为网址)过长,服务器无法处理。 |
415(不支持的媒体类型) | 请求的格式不受请求页面的支持。 |
416(请求范围不符合要求) | 如果页面无法提供请求的范围,则服务器会返回此状态码。 |
417(未满足期望值) | 服务器未满足”期望”请求标头字段的要求。 |
5xx(服务器错误)
这些状态码表示服务器在处理请求时发生内部错误。这些错误可能是服务器本身的错误,而不是请求出错。
500(服务器内部错误) | 服务器遇到错误,无法完成请求。 |
501(尚未实施) | 服务器不具备完成请求的功能。例如,服务器无法识别请求方法时可能会返回此代码。 |
502(错误网关) | 服务器作为网关或代理,从上游服务器收到无效响应。 |
503(服务不可用) | 服务器目前无法使用(由于超载或停机维护)。通常,这只是暂时状态。 |
504(网关超时) | 服务器作为网关或代理,但是没有及时从上游服务器收到请求。 |
505(HTTP 版本不受支持) | 服务器不支持请求中所用的 HTTP 协议版本。 |
上书大部分实际内容源自googel管理员博客近日文章所引用的有关301说明的有些链接,感觉非常有用,因此收藏注释,以备以后警戒注意学习。合理利用这些状态码,避免错误利用,必将会为你的网站带来更佳的浏览者体会,得到更加亲和的搜索引擎收录,得到更准确的搜索引擎切入,从而,为你的网站发展,奠定坚实的发展基础。
想了想,还是加上原版吧,有助于理解
HTTP status codes
When a request is made to your server for a page on your site (for instance, when a user accesses your page in a browser or when Googlebot crawls the page), your server returns an HTTP status code in response to the request.
This status code provides information about the status of the request. This status code gives Googlebot information about your site and the requested page.
Some common status codes are:
- 200 - the server successfully returned the page
- 404 - the requested page doesn't exist
- 503 - the server is temporarily unavailable
A complete list of HTTP status codes is below. You can also visit the W3C page on HTTP status codes for more information.
1xx (Provisional response)
Status codes that indicate a provisional response and require the requestor to take action to continue.
Code | Description |
---|---|
100 (Continue) | The requestor should continue with the request. The server returns this code to indicate that it has received the first part of a request and is waiting for the rest. |
101 (Switching protocols) | The requestor has asked the server to switch protocols and the server is acknowledging that it will do so. |
2xx (Successful)
Status codes that indicate that the server successfully processed the request.
Code | Description |
---|---|
200 (Successful) | The server successfully processed the request. Generally, this means that the server provided the requested page. If you see this status for your robots.txt file, it means that Googlebot retrieved it successfully. |
201 (Created) | The request was successful and the server created a new resource. |
202 (Accepted) | The server has accepted the request, but hasn't yet processed it. |
203 (Non-authoritative information) | The server successfully processed the request, but is returning information that may be from another source. |
204 (No content) | The server successfully processed the request, but isn't returning any content. |
205 (Reset content) | The server successfully proccessed the request, but isn't returning any content. Unlike a 204 response, this response requires that the requestor reset the document view (for instance, clear a form for new input). |
206 (Partial content) | The server successfully processed a partial GET request. |
3xx (Redirected)
Further action is needed to fulfill the request. Often, these status codes are used for redirection. Google recommends that you use fewer than five redirects for each request. You can use Webmaster Tools to see if Googlebot is having trouble crawling your redirected pages. The Crawl Errors page under Crawl lists URLs that Googlebot was unable to crawl due to redirect errors.
Code | Description |
---|---|
300 (Multiple choices) | The server has several actions available based on the request. The server may choose an action based on the requestor (user agent) or the server may present a list so the requestor can choose an action. |
301 (Moved permanently) | The requested page has been permanently moved to a new location. When the server returns this response (as a response to a GET or HEAD request), it automatically forwards the requestor to the new location. You should use this code to let Googlebot know that a page or site has permanently moved to a new location. |
302 (Moved temporarily) | The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. This code is similar to a 301 in that for a GET or HEAD request, it automatically forwards the requestor to a different location, but you shouldn't use it to tell the Googlebot that a page or site has moved because Googlebot will continue to crawl and index the original location. |
303 (See other location) | The server returns this code when the requestor should make a separate GET request to a different location to retrieve the response. For all requests other than a HEAD request, the server automatically forwards to the other location. |
304 (Not modified) | The requested page hasn't been modified since the last request. When the server returns this response, it doesn't return the contents of the page. You should configure your server to return this response (called the If-Modified-Since HTTP header) when a page hasn't changed since the last time the requestor asked for it. This saves you bandwidth and overhead because your server can tell Googlebot that a page hasn't changed since the last time it was crawled. |
305 (Use proxy) | The requestor can only access the requested page using a proxy. When the server returns this response, it also indicates the proxy that the requestor should use. |
307 (Temporary redirect) | The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. This code is similar to a 301 in that for a GET or HEAD request, it automatically forwards the requestor to a different location, but you shouldn't use it to tell the Googlebot that a page or site has moved because Googlebot will continue to crawl and index the original location. |
4xx (Request error)
These status codes indicate that there was likely an error in the request which prevented the server from being able to process it.
Code | Description |
---|---|
400 (Bad request) | The server didn't understand the syntax of the request. |
401 (Not authorized) | The request requires authentication. The server might return this response for a page behind a login. |
403 (Forbidden) | The server is refusing the request. If you see that Googlebot received this status code when trying to crawl valid pages of your site (you can see this on the Crawl Errors page under Health in Google Webmaster Tools), it's possible that your server or host is blocking Googlebot's access. |
404 (Not found) | The server can't find the requested page. For instance, the server often returns this code if the request is for a page that doesn't exist on the server. If you don't have a robots.txt file on your site and see this status on the Blocked URLs page in Google Webmaster Tools, this is the correct status. However, if you do have a robots.txt file and you see this status, then your robots.txt file may be named incorrectly or in the wrong location. (It should be at the top-level of the domain and named robots.txt.) If you see this status for URLs that Googlebot tried to crawl, then Googlebot likely followed an invalid link from another page (either an old link or a mistyped one). |
405 (Method not allowed) | The method specified in the request is not allowed. |
406 (Not acceptable) | The requested page can't respond with the content characteristics requested. |
407 (Proxy authentication required) | This status code is similar 401 (Not authorized); but specifies that the requestor has to authenticate using a proxy. When the server returns this response, it also indicates the proxy that the requestor should use. |
408 (Request timeout) | The server timed out waiting for the request. |
409 (Conflict) | The server encountered a conflict fulfilling the request. The server must include information about the conflict in the response. The server might return this code in response to a PUT request that conflicts with an earlier request, along with a list of differences between the requests. |
410 (Gone) | The server returns this response when the requested resource has been permanently removed. It is similar to a 404 (Not found) code, but is sometimes used in the place of a 404 for resources that used to exist but no longer do. If the resource has permanently moved, you should use a 301 to specify the resource's new location. |
411 (Length required) | The server won't accept the request without a valid Content-Length header field. |
412 (Precondition failed) | The server doesn't meet one of the preconditions that the requestor put on the request. |
413 (Request entity too large) | The server can't process the request because it is too large for the server to handle. |
414 (Requested URI is too long) | The requested URI (typically, a URL) is too long for the server to process. |
415 (Unsupported media type) | The request is in a format not support by the requested page. |
416 (Requested range not satisfiable) | The server returns this status code if the request is for a range not available for the page. |
417 (Expectation failed) | The server can't meet the requirements of the Expect request-header field. |
5xx (Server error)
These status codes indicate that the server had an internal error when trying to process the request. These errors tend to be with the server itself, not with the request.
Code | Description |
---|---|
500 (Internal server error) | The server encountered an error and can't fulfill the request. |
501 (Not implemented) | The server doesn't have the functionality to fulfill the request. For instance, the server might return this code when it doesn't recognize the request method. |
502 (Bad gateway) | The server was acting as a gateway or proxy and received an invalid response from the upstream server. |
503 (Service unavailable) | The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. |
504 (Gateway timeout) | The server was acting as a gateway or proxy and didn't receive a timely request from the upstream server. |
505 (HTTP version not supported) | The server doesn't support the HTTP protocol version used in the request. |