Simply put, 301 and 302 redirections are when the user and the search engine are forwarded to a different URL (Uniform Reference Locator) from the one they originally wanted or requested.
A 301 redirect is a code which informs the search engines that the site for your domain name has been permanently moved to the new URL destination. From a SEO point of view and the user perspective, 301 redirect is the most common type of redirection that people should use.
A 302 redirect informs the search engines that the site for your domain name has been temporarily moved to a new URL destination. Use 302 redirect if you are planning eventually to bring the old page or website back.
Another example of using the 302 redirect is when you are working on a new website. It’s worth mentioning that the longer a 302 redirect is implemented, the more likely it is that the search engines will index the new page, rather than conserving the information from your original site on your domain.