What does HTTP/1.1 302 mean exactly?

后端 未结 14 2420
礼貌的吻别
礼貌的吻别 2020-12-02 05:49

Some article I read once said that it means jumping (from one URI to another), but I detected this \"302\" even when there was actually no jumping at all!

相关标签:
14条回答
  • 2020-12-02 06:05

    302 is a response indicating change of resource location - "Found".

    The url where the resource should be now located should be in the response 'Location' header.

    The "jump" should be done by the requesting client (make a new request to the resource url in the response Location header field).

    0 讨论(0)
  • 2020-12-02 06:05

    A 302 status code is HTTP response status code indicating that the requested resource has been temporarily moved to a different URI. Since the location or current redirection directive might be changed in the future, a client that receives a 302 Found response code should continue to use the original URI for future requests.

    An HTTP response with this status code will additionally provide a URL in the header field Location. This is an invitation to the user agent (e.g. a web browser) to make a second, otherwise identical, request to the new URL specified in the location field. The end result is a redirection to the new URL.

    0 讨论(0)
  • 2020-12-02 06:06

    A simple way of looking at HTTP 301 vs. 302 redirects is:

    Suppose you have a bookmark to "http://sample.com/sample". You use a browser to go there.

    A 302 redirect to a different URL at this point would mean that you should keep your bookmark to "http://sample.com/sample". This is because the destination URL may change in the future.

    A 301 redirect to a different URL would mean that your bookmark should change to point to the new URL as it is a permanent redirect.

    0 讨论(0)
  • 2020-12-02 06:08

    A 302 redirect means that the page was temporarily moved, while a 301 means that it was permanently moved.

    301s are good for SEO value, while 302s aren't because 301s instruct clients to forget the value of the original URL, while the 302 keeps the value of the original and can thus potentially reduce the value by creating two, logically-distinct URLs that each produce the same content (search engines view them as distinct duplicates rather than a single resource with two names).

    0 讨论(0)
  • 2020-12-02 06:10

    HTTP code 302 is for redirection see http://en.wikipedia.org/wiki/HTTP_302.

    It tells the browse reading a page to go somewhere else and load another page. Its usage is very common.

    0 讨论(0)
  • 2020-12-02 06:11

    From RFC 2616 (the Hypertext Transfer Protocol Specification):

    10.3.3 302 Found
    
       The requested resource resides temporarily under a different URI.
       Since the redirection might be altered on occasion, the client SHOULD
       continue to use the Request-URI for future requests.  This response
       is only cacheable if indicated by a Cache-Control or Expires header
       field.
    
       The temporary URI SHOULD be given by the Location field in the
       response. Unless the request method was HEAD, the entity of the
       response SHOULD contain a short hypertext note with a hyperlink to
       the new URI(s).
    

    Source:

    http://www.ietf.org/rfc/rfc2616.txt

    0 讨论(0)
提交回复
热议问题