HTTP Status Codes - Part 3 of Chapter 3 from HTTP: The Definitive Guide (3/6) | WebReference

HTTP Status Codes - Part 3 of Chapter 3 from HTTP: The Definitive Guide (3/6)

To page 1To page 2current pageTo page 4To page 5To page 6
[previous] [next]

HTTP: The Definitive Guide, Chapter 3: HTTP Messages

300-399: Redirection Status Codes

The redirection status codes either tell clients to use alternate locations for the resources they're interested in or provide an alternate response instead of the content. If a resource has moved, a redirection status code and an optional Location header can be sent to tell the client that the resource has moved and where it can now be found (see Figure 3-14). This allows browsers to go to the new location transparently, without bothering their human users.

Redirected request to new location
Figure 3-14. Redirected request to new location

Some of the redirection status codes can be used to validate an application's local copy of a resource with the origin server. For example, an HTTP application can check if the local copy of its resource is still up-to-date or if the resource has been modified on the origin server. Figure 3-15 shows an example of this. The client sends a special If-Modified-Since header saying to get the document only if it has been modified since October 1997. The document has not changed since this date, so the server replies with a 304 status code instead of the contents.

Request redirected to use local copy
Figure 3-15. Request redirected to use local copy


To page 1To page 2current pageTo page 4To page 5To page 6
[previous] [next]

Created: January 29, 2003
Revised: January 29, 2003

URL: https://webreference.com/programming/http/chap3/3/3.html