HTTP Status Code 301 302

Source: Internet
Author: User
Tags rfc

301 Moved Permanently
The requested resource has been permanently moved to a new location, and any future references to this resource should use one of several URIs returned by this response. If possible, clients that have link editing capabilities should automatically modify the requested address to the address returned from the server. Unless otherwise specified, the response is cacheable.
The new permanent URI should be returned in the location domain of the response. Unless this is a head request, the response entity should contain a hyperlink to the new URI and a short description.
If this is not a get or head request, the browser disables automatic redirection unless the user confirms it, because the requested condition may vary.
Note: For some browsers that use the http/1.0 protocol, when they send a POST request that gets a 301 response, the next redirect request becomes a Get method.


302 Found
The requested resource is now temporarily responding to requests from different URIs. Because such redirects are temporary, the client should continue to send subsequent requests to the original address. This response is cacheable only if specified in Cache-control or expires.
The new temporary URI should be returned in the location domain of the response. unless this is a head request, the response entity should contain a hyperlink to the new URI and a short description.
If this is not a get or head request, then the browser disables automatic redirection unless the user confirms it, because the requested condition may vary.
Note: Although the RFC 1945 and RFC 2068 specifications do not allow the client to change the method of the request during redirection, many existing browsers treat the 302 response as a 303 response, and use get to access the URI specified in the location, ignoring the method originally requested. Status Codes 303 and 307 are added to clarify how the server expects the client to react.

In detail, both the 301 and 302 status codes represent redirects, meaning that the browser automatically jumps to a new URL address when it gets the status code returned by the server. This address can be obtained from the location header of the response (the effect that the user sees is that the address a that he entered becomes another address B)-that's what they have in common. The difference between them is. 301 indicates that the resource of the old address A has been permanently removed (the resource is inaccessible), the search engine crawls the new content and also exchanges the old URL to redirect the URL, 302 indicates that the old address a resource is still (accessible), the redirect is temporarily from the old address A to address B, Search engines crawl new content and save old URLs.

HTTP Status Code 301 302

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.