There are a number of ways you can redirect a webpage or an entire website, but the main ways includes using a 301 or 302 response code. By using one of these codes, Google will know how to respond to the redirected webpage.
But what are are 301 and 302 redirects, and what is different about them?
According to Indeed.com:
A 301 redirect is a type of HTTP response code that indicates to viewers that you have moved the site to a new location. This code is a signal for search engines that communicates the need to direct users to the new URL. Using this redirect allows site owners to maintain their previous SEO ranking while still transitioning to a new site location. A 301 redirect is a permanent change in your website’s address, so it’s best to use it when you do not plan on using the old URL again.
Similar to a 301 redirect, a 302 is an HTTP response code that forwards search engine traffic to a new URL. A 302 redirect code is a way to tell a search engine that you have temporarily relocated your site to a new URL and that it should forward any traffic intended for the old address to the temporary location. Although a 302 redirect is meant to be temporary, it will last until the site administrator manually removes the redirect, so they often remain in place for a long period of time.
In a nutshell, a 301 redirect moves a webpage or site permanently to a new location, while a 302 refers to the status code “Found,” which means the site or page has only been moved temporarily.
Adam Heitzman has written a guide on Search Engine Journal where they cover what 301 and 302 codes are for, when they are used, and how they are impact SEO.