Why we use 302 redirection?

HTTP status code 301 is known as permanent redirect. It means that the resource (page) is moved permanently to a new location. The client/browser should not attempt to request the original location but use the new location from now on.

HTTP status code 302 means that the resource is temporarily located somewhere else, and the client/browser should continue requesting the original url for subsequent requests.

Edit

Why do we use these codes?

Browsers(well most of them) cache 301 redirects indefinitely. So when browser makes a call to original resource second time, it always calls the redirected resource. To undo this, you need to issue a 301 direct from new resource to old resource. If you would like to control the caching duration, you can use the the HTTP response headers Cache-Control and Expires to do the same.

302 redirects are not cached by browsers. So when browser makes a call to original resource second time, it calls the original resource.
 
302 redirect is a temporary redirection process where we redirect a URL and the traffic of that URL for temporary basis. This is easy to implement but try to avoid this as this redirection sometimes shows an broken link and used for doing spam also.
 
A 302 redirect is a temporary redirect. There are very few instances where this type of redirect should be used, but unfortunately it is the easiest to implement. This means that many webmasters unfamiliar with search engine mechanics use the wrong type of redirect.
 
Back
Top