Do you know that WordPress have a built-in function to redirect users to a specific url? It is called wp_redirect(). Many users don’t know it, but you can also create 301 redirections with that useful function.
To create a 301 redirection within WordPress, you just have to add the 301 argument to the function:
<?php wp_redirect('https://www.wprecipes.com', 301); ?>
The above code will redirect anyone on my blog. Don’t hesitate to use it 😀