301 vs 302: the key choice
A 301 is a permanent move: it transfers ranking signals to the new URL and tells search engines to update their index. A 302 is temporary: the original URL is expected to return, so engines keep indexing the old one. Using a 302 for a permanent move is the classic mistake that quietly tanks rankings.