HTTP Code 301 vs 302
301
Status 301 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.
Search engine
When a search engine spider finds 301 status code in the response header of a webpage, it understands that this webpage no longer exists, it searches for location header in response pick the new URL and replace the indexed URL with the new one and also transfer pagerank.
Browser
Browser: if a browser finds 301 status code then it caches the mapping of the old URL with the new URL, the client/browser will not attempt to request the original location but use the new location from now on unless the cache is cleared.
302
Status 302 means that the resource is temporarily located somewhere else, and the client/browser should continue requesting the original url.
Search engine
When a search engine spider finds 302 status for a webpage, it will only redirect temporarily to the new location and crawl both of the pages. The old webpage URL still exists in the search engine database and it always attempts to request the old location and crawl it.
Browser
The client/browser will still attempt to request the original location.
Reference
HTTP redirect: 301 (permanent) vs. 302 (temporary) - Stack Overflow