Skip to content
Home » HTTP Response Status Codes: Redirection (300 – 399)

HTTP Response Status Codes: Redirection (300 – 399)

http-code-3xx

HTTP response status codes are crucial elements in web communication, providing vital information about the outcome of a client’s request.

In our previous blog posts, we explored Informational Responses (100 – 199) and Successful Responses (200 – 299), learning how they establish communication and indicate the success of a request.

Now, let’s embark on a journey through the third class of HTTP response status codes – Redirection Responses (300 – 399). These codes indicate that further action is needed to complete the client’s request. Join us as we delve into each of these redirection responses, understanding their meanings and use cases.

Table: HTTP Response Status Codes – Redirection Responses

Status CodeNameDescriptionExample
300Multiple ChoicesThe requested resource has multiple choices, each with different locations.HTTP/1.1 300 Multiple Choices
301Moved PermanentlyThe requested resource has been permanently moved to a new location.HTTP/1.1 301 Moved Permanently
302Found / Moved TemporarilyThe requested resource is temporarily located elsewhere.HTTP/1.1 302 Found (or HTTP/1.1 302 Moved Temporarily)
303See OtherThe response to the request can be found under a different URI.HTTP/1.1 303 See Other
304Not ModifiedThe client’s cached version of the requested resource is up to date.HTTP/1.1 304 Not Modified
307Temporary RedirectSimilar to 302, but the client must preserve the request method when redirecting to the new URL.HTTP/1.1 307 Temporary Redirect
308Permanent RedirectThe requested resource has been permanently moved to a new location.HTTP/1.1 308 Permanent Redirect

HTTP 3xx Status Codes (Redirection Responses):

  1. 300 Multiple Choices:
    • Description: The requested resource has multiple choices, each with different locations. The server includes a Location header in the response to provide options for the client to follow.
    • Example: HTTP/1.1 300 Multiple Choices
  2. 301 Moved Permanently:
    • Description: The requested resource has been permanently moved to a new location. The client should update its links to use the new URL in future requests.
    • Example: HTTP/1.1 301 Moved Permanently
  3. 302 Found / Moved Temporarily:
    • Description: The requested resource is temporarily located elsewhere. The client should use the new URL for future requests, but the old URL may still be used in some cases.
    • Example: HTTP/1.1 302 Found or HTTP/1.1 302 Moved Temporarily
  4. 303 See Other:
    • Description: The response to the request can be found under a different URI. The client should use a GET request to retrieve the resource from the new location.
    • Example: HTTP/1.1 303 See Other
  5. 304 Not Modified:
    • Description: The client’s cached version of the requested resource is up to date, and there is no need to transfer the same content again. The server sends this response to save bandwidth and reduce unnecessary requests.
    • Example: HTTP/1.1 304 Not Modified
  6. 307 Temporary Redirect:
    • Description: Similar to 302, but the client must preserve the request method when redirecting to the new URL. This ensures that non-GET requests, such as POST or PUT, are also redirected.
    • Example: HTTP/1.1 307 Temporary Redirect
  7. 308 Permanent Redirect:
    • Description: The requested resource has been permanently moved to a new location. The client should update its links to use the new URL, and future requests should be directed there.
    • Example: HTTP/1.1 308 Permanent Redirect

Redirection responses (status codes 300 – 399) indicate that the client’s request cannot be completed as expected with the current URL. Instead, the server provides information about alternative locations where the requested resource can be found. These redirection responses play a crucial role in maintaining a smooth user experience when URLs change or resources are moved.

As a web developer, understanding these redirection responses helps in handling redirects properly and ensuring that users can access the right content even when URLs change.

Next, we’ll explore Client Error Responses (400 – 499), which indicate that the client’s request contains errors or cannot be fulfilled. Happy coding!


Visit Techtalkbook to find more related topics.


References

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

1 thought on “HTTP Response Status Codes: Redirection (300 – 399)”

  1. Pingback: Macronimous Blog | Essential HTTP Status Codes Every web Programmer Should Know

Leave a Reply

Your email address will not be published. Required fields are marked *

1 Shares
Tweet
Pin1
Share
Share
Share