Over the last days some including me have opened tickets in wordpress trac touching the HTTP transport layer and redirection in specific.
As with my previous HTTP related review of worpdress, this is getting more and more interesting and detailed as well.
Looking from the HTTP Status Code sepcifications in the redirection class, the following table tries to give an overview:
|300 Multiple Choices||SHOULD include||MAY use for automatic redirection|
|301 Moved Permanently||SHOULD be given||MUST NOT automatically redirect|
|302 Found||SHOULD be given||MUST NOT automatically redirect|
|303 See Other||SHOULD be given||SHOULD retrieve by GET|
|304 Not Modfied||n/a||n/a|
|305 Use Proxy||MUST||MUST|
|306 (Unused)||(was: Switch Proxy)|
|307 Temporary Redirect||SHOULD be given||MUST NOT automatically redirect|
Looking from the Location field specification, the related information is more broadly:
For 3xx responses, the location SHOULD indicate the server’s preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI.
The location field is used for other status codes as well (e.g. 201), I was not able to compile a full list so far.
The Location field plays an important role in the HTTP 3xx redirect status-code class, the usage varies a bit between the different codes, but genreally it was designed for automatic redirection.
Automatic redirection is not always considered safe these days, so take care – user-agents may not perform them anyway according to the specs.
An interesting information bit is, that servers and applications should not expect clients to handle more than 5 redirects in a row for compatibility reasons. There is more in Redirection 3xx so it’s probably worth for a second write-up of HTTP redirects for web-developers in general with a comparison between HTTP/1.0 and HTTP/1.1 as well.