WordPress includes some really handy pluggable functions one of which is
This function can easily be written into a custom function with a conditional tag and hook to create a 301 redirect.
Here’s a working example which redirects from a page with the slug ‘shop’ to the blog page:
You need to subscribe to fully access this tutorial.
You don’t need to use a 301 redirect with this function if you don’t want. You can use the wp_redirect() function for any type of redirect.