redirection / przekierowania 301 302 http 1.1

Status Code Definitions HTTP/1.1 Redirection 3xx – HTTP Request and Response Header – dotyczą one:
Ta klasa odpowiedzi oznacza iż powinny zostać wykonane dalsze czynności przez użytkownika w celu spełnienia żądania. Działania mogą być przeprowadzone przez użytkownika bez interakcji z nim tylko jeśli metoda stosowana w drugim żądaniu jest GET lub HEAD. Klient powinien wykryć przekierowanie nieskończonej pętli, ponieważ takie przekierowania są generowane w ruchu sieciowym dla każdego przekierowania.

Uwaga: poprzednie wersje specyfikacji zalecały maksymalnie pięć przekierowań. Deweloperzy powinni być świadomi, że mogą być klienci którzy wdrożyli takie ograniczenia na stałe.

300 Multiple Choices ( Wiele możliwości/opcji )

The requested resource corresponds to any one of a set of representations, each with its own specific location, and agent- driven negotiation information (section 12) is being provided so that the user (or user agent) can select a preferred representation and redirect its request to that location.

Unless it was a HEAD request, the response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content- Type header field. Depending upon the format and the capabilities of

the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection.

If the server has a preferred choice of representation, it SHOULD include the specific URI for that representation in the Location field; user agents MAY use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise.

301 Moved Permanently ( Trwale przeniesiony / Przeniesiony na stałe )

Żądany zasób otrzymał nowy stały adres URI i przyszłe odniesienia do tego zasobu powinny odnosić się do jednego zwróconego URI. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.

The new permanent URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

If the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

Uwaga: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request.