There are multiple ways to redirect a webpage or an entire website, the two main ways being either a 301 or 302 HTTP response code.
Choosing the right one for the appropriate situation is important for SEO because it sends a signal to Google about how to respond to the redirected webpage, including whether to consider it as canonical.
While Google is constantly evolving how it handles signals, that provided by 301 and 302 response codes has not changed.