3xx-重定向

title

3xx 这类状态代码表示客户端浏览器必须采取更多操作来实现请求。例如,浏览器可能不得不请求服务器上的不同的页面,或通过代理服务器重复该请求。

HTTP 3xx状态码是指客户端请求的资源已经被移动到其他位置,需要进行重定向操作才能访问。这些状态码通常用于处理网站迁移或资源更新的情况。以下是一些常见的HTTP 3xx状态码及其含义:

  • 300 Multiple Choices:请求的资源有多个可供选择的表示形式,每种表示形式都有自己的特定位置。服务器可以列出这些位置,由客户端选择其中一个进行访问。
  • 301 Moved Permanently:请求的资源已被永久移动到新位置。客户端应该使用新的URL重新请求资源。
  • 302 Found:请求的资源已被暂时移动到新位置。客户端应该继续使用原始的URL请求资源,因为将来该资源可能会恢复到原始位置。
  • 303 See Other:请求的资源可以在不同的URI位置找到。客户端应该使用新的URI发送GET请求来检索资源。
  • 304 Not Modified:客户端可以使用缓存版本的资源,因为服务器确认该资源自上次请求后没有被修改过。服务器返回此状态码时,不会返回资源实体。
  • 307 Temporary Redirect:请求的资源已被暂时移动到新位置。客户端应该继续使用原始的URL请求资源,因为将来该资源可能会恢复到原始位置。

这些状态码告诉客户端请求的资源不再原始位置上,而是被移动到了其他位置,客户端需要使用新的URL进行访问。其中,301和302状态码是最常用的重定向状态码,301表示资源被永久移动,302表示资源被暂时移动。

Redirection 3xx

   This class of status code indicates that further action needs to be
   taken by the user agent in order to fulfill the request.  The action
   required MAY be carried out by the user agent without interaction
   with the user if and only if the method used in the second request is
   GET or HEAD. A client SHOULD detect infinite redirection loops, since
   such loops generate network traffic for each redirection.

      Note: previous versions of this specification recommended a
      maximum of five redirections. Content developers should be aware
      that there might be clients that implement such a fixed
      limitation.

300 | 301 | 302 | 303 | 304 | 305 | 306 | 307

更多3xx

powered by Gitbook© 2023 编外计划 | 最后修改: 2023-11-24 03:36:58

results matching ""

    No results matching ""