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.

303
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.

307
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,

http://www.blah.com
might redirect to
http://www.blah.com/home/show.do
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.

308
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. (As of 2018, some older versions of Internet Explorer still in use don't support 308. You may want to use 307 instead.)

302
For many years, there was ambiguity in the specification of redirect 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