WordPress 301 redirect
Create a 301 redirect with Yoast SEO
Creating a 301 redirect with PHP
If you’re a developer working with WordPress, this is the only proper way of doing a 301 redirect in WordPress:
wp_redirect( get_permalink( $url ), 301 );
It’s easy enough. But when you forget the
301, WordPress, like PHP, defaults to a 302 redirect, which is not what you want in all cases.