Apply correct redirect code

An HTTP redirect instructs the browser to perform a second HTTP request, to a different URL. There are several HTTP redirect codes you should be aware of.

Intended for POSTed forms which change state on the server. Typically, these operations edit the database in some way. The 303 is explicitly intended for this case. Here, the two operations are POST (or some other HTTP method), then redirect-to-GET. The redirect-to-GET usually shows an updated view of the database, to reflect the result of the original POST operation.

Redirect temporarily, and preserve the HTTP method (usually either GET or POST). An example is a redirect for showing the home page of a domain. For example,
might redirect to
This redirect is defined to be temporary. That means that the browser can still use the original URL later. This lets the app change its mind, if needed, and redirect the browser to some other URL instead.

Redirect permanently, and preserve the HTTP method (usually either GET or POST). In this case the old URL is obsolete, and should always be replaced by the browser with the supplied new URL.

For many years, there was ambiguity in the specification of these codes. That ambiguity has now been removed. As a result, the 302 status code has now been superseded by other codes.

See Also :
Forward versus redirect