URL Redirection - Techniques - HTTP Status Codes 3xx

HTTP Status Codes 3xx

In the HTTP protocol used by the World Wide Web, a redirect is a response with a status code beginning with 3 that causes a browser to display a different page. The different codes describe the reason for the redirect, which allows for the correct subsequent action (such as changing links in the case of code 301, a permanent change of address).

The HTTP standard defines several status codes for redirection:

  • 300 multiple choices (e.g. offer different languages)
  • 301 moved permanently
  • 302 found (originally temporary redirect, but now commonly used to specify redirection for unspecified reason)
  • 303 see other (e.g. for results of cgi-scripts)
  • 307 temporary redirect

All of these status codes require that the URL of the redirect target be given in the Location: header of the HTTP response. The 300 multiple choices will usually list all choices in the body of the message and show the default choice in the Location: header.

(Status codes 304 not modified and 305 use proxy are not redirects).

An HTTP response with the 301 "moved permanently" redirect looks like this:

HTTP/1.1 301 Moved Permanently Location: http://www.example.org/ Content-Type: text/html Content-Length: 174

Read more about this topic:  URL Redirection, Techniques

Famous quotes containing the words status and/or codes:

    At all events, as she, Ulster, cannot have the status quo, nothing remains for her but complete union or the most extreme form of Home Rule; that is, separation from both England and Ireland.
    George Bernard Shaw (1856–1950)

    ... until both employers’ and workers’ groups assume responsibility for chastising their own recalcitrant children, they can vainly bay the moon about “ignorant” and “unfair” public criticism. Moreover, their failure to impose voluntarily upon their own groups codes of decency and honor will result in more and more necessity for government control.
    Mary Barnett Gilson (1877–?)