HTTP status codes 200, 301, 403, 404, 500, etc. (transfer)

Reprinted from: https://blog.tanteng.me/2012/09/http-200-301-403-404-500/

HTTP status codes and their meanings are often tested in web front-end interviews and must be mastered.

Some common status codes are:

200 – The server successfully returned the page

404 - The requested page does not exist

503 – Server timed out

A complete list of HTTP status codes is provided below.

I. Temporary Response 

1xx (provisional response)

A status code that represents a provisional response and requires the requester to continue with the operation.

100 (Continue) The requester should proceed with the request. The server returns this code to indicate that the first part of the request has been received and is waiting for the rest.

101 (Switch protocol) The requester has asked the server to switch protocols, the server has confirmed and is ready to switch.

2. Success

2xx (success)

Status code indicating that the request was successfully processed.

200 (Success) The server has successfully processed the request. Typically, this means that the server served the requested web page. If this status code is displayed for your robots.txt file, it means that Googlebot has successfully retrieved the file.

201 (Created) The request was successful and the server created a new resource.

202 (Accepted) The server has accepted the request but has not yet processed it.

203 (Unauthorized information) The server has successfully processed the request, but the returned information may have come from another source.

204 (No Content) The server successfully processed the request but returned no content.

205 (Content reset) The server successfully processed the request but returned nothing. Unlike the 204 response, this response requires the requester to reset the document view (eg, clear the form content to enter new content).

206 (Partial Content) The server successfully processed a partial GET request.

3. Redirect

3xx (redirect)

To complete the request, further action is required. Typically, these status codes are used for redirection. Google recommends that you use no more than 5 redirects per request. You can use Webmaster Tools to see if Googlebot is having trouble crawling redirected pages. The Web Crawl page under Diagnostics lists URLs that Googlebot could not crawl due to redirect errors.

300 (multiple choices) The server can perform various operations on the request. The server may select an action based on the requestor (user agent), or provide a list of actions for the requester to choose from.

301 (Moved Permanently) The requested webpage has been permanently moved to a new location. When the server returns this response (to a GET or HEAD request), it automatically redirects the requester to the new location. You should use this code to tell Googlebot that a page or site has been permanently moved to a new location.

302 (Moved temporarily) The server is currently responding to requests from a web page in a different location, but the requester should continue to use the original location for future requests. This code is similar to the 301 code for responding to GET and HEAD requests and will automatically send the requester to a different location, but you should not use this code to tell Googlebot that a page or site has moved, as Googlebot will continue to crawl the original location and indexing.

303 (See other locations) The server returns this code when the requester should use a separate GET request for a different location to retrieve the response. For all requests except HEAD, the server automatically goes elsewhere.

304 (Not Modified) The requested page has not been modified since the last request. When the server returns this response, no web page content is returned.

You should configure your server to return this response (known as the If-Modified-Since HTTP header) if the page has not changed since the requester's last request. The server can tell Googlebot that the page has not changed since the last crawl, saving bandwidth and overhead.

.

305 (Use Proxy) The requester can only use a proxy to access the requested web page. If the server returns this response, it also indicates that the requester should use a proxy.

307 (Temporary Redirect) The server is currently responding to the request from a web page in a different location, but the requester should continue to use the original location for future requests. This code is similar to the 301 code in response to GET and HEAD requests and will automatically send the requester to a different location, but you should not use this code to tell Googlebot that a page or site has moved, as Googlebot will continue to crawl the original location and indexing.

Fourth, the request error

4xx (request error)

These status codes indicate that the request may have gone wrong, preventing the server from processing it.

400 (Bad Request) The server does not understand the syntax of the request.

401 (Unauthorized) The request requires authentication. The server may return this response for web pages requested after login.

403 (Forbidden) The server rejected the request. If you see this status code when Googlebot is trying to crawl a valid page on your site (you can see this on the Web Crawl page under Google Webmaster Tools Diagnostics), your server or host may be rejecting it Googlebot access.

404 (Not Found) The server cannot find the requested web page. For example, this code is often returned for pages that do not exist on the server.

If you don't have a robots.txt file on your site, and you see this status code on the robots.txt page of the Diagnostics tab of Google Webmaster Tools, this is the correct status code. However, if you have a robots.txt file and you see this status code, your robots.txt file may be named incorrectly or in the wrong location (it should be on the top-level domain, called robots.txt).

If you see this status code (on the HTTP Errors page in the Diagnostics tab) for URLs crawled by Googlebot, it means that Googlebot may be following a dead link (either an old link or a mistyped link) from another page.

405 (Method Disabled) Disables the method specified in the request.

406 (Not Accepted) The requested web page could not be responded to with the requested content attributes.

407 (Proxy Authorization Required) This status code is similar to 401 (Unauthorized), but specifies that the requester should authorize the use of the proxy. If the server returns this response, it also indicates that the requester should use a proxy.

408 (Request Timeout) The server timed out while waiting for the request.

409 (Conflict) The server has a conflict in completing the request. The server MUST include information about the conflict in the response. The server may return this code in response to a PUT request that conflicts with the previous request, along with a list of the differences between the two requests.

410 (Deleted) The server returns this response if the requested resource has been permanently deleted. This code is similar to the 404 (Not Found) code, but is sometimes used in place of the 404 code in cases where the resource used to exist but does not exist now. If the resource has been moved permanently, you should use 301 to specify the new location of the resource.

411 (Valid Length Required) The server will not accept requests that do not contain a payload-length header field.

412 (Precondition not met) The server did not satisfy one of the preconditions set by the requester in the request.

413 (Request Entity Too Large) The server cannot process the request because the request entity is too large for the server to handle.

414 (Requested URI too long) The requested URI (usually a URL) is too long for the server to process.

415 (Unsupported media type) The requested format is not supported by the requested page.

416 (The requested range does not meet the requirements) The server returns this status code if the page cannot provide the requested range.

417 (Expected value not met) The server did not meet the requirements for the "Expected" request header field.

5. Server Error

5xx (server error)

These status codes indicate that the server experienced an internal error while processing the request. These errors may be errors of the server itself, not the request.

500 (Internal Server Error) The server encountered an error and could not complete the request.

501 (Not yet implemented) The server does not have the capability to complete the request. This code may be returned, for example, when the server does not recognize the request method.

502 (Bad Gateway) The server, acting as a gateway or proxy, received an invalid response from an upstream server.

503 (Service Unavailable) The server is currently unavailable (due to overloading or downtime for maintenance). Usually, this is only a temporary state.

504 (Gateway Timeout) The server acts as a gateway or proxy, but did not receive a request from the upstream server in a timely manner.

505 (HTTP version not supported) The server does not support the HTTP protocol version used in the request.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324602721&siteId=291194637