302 Moved Temporarily和302 Found有什么区别?

同样是302跳转,我看有时候是302 Moved Temporarily,有时候是302 Found,这两个有啥区别呢?

阅读 50.5k
3 个回答

二者在不同HTTP协议下的状态信息不同。

在HTTP/1.0 302 状态为 Moved Temporarily

The requested resource resides temporarily under a different URL. Since the redirection may be altered on occasion, the client should continue to use the Request-URI for future requests.

在HTTP/1.1 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.

参考链接
HTTP/1.1 -> http://www.w3.org/Protocols/rfc2616/r...
HTTP/1.0 -> http://www.w3.org/Protocols/HTTP/1.0/...

按照http1.1的标准,302状态只能是Found,没有Moved Temporarily,所以Move Temporarily估计只是一个不标准的描述而已
虽然status code后面的描述是可以自定义,但是既然使用了http协议,还是应该按照他的标准来做

http status code以及描述可见w3c文档:http://www.w3.org/Protocols/rfc2616/r...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏