You can do this in code, htaccess, or go the fastest way to get it done reliably using a redirection plugin.
Here are three redirection plugins vetted by WordPress VIP:
https://vip.wordpress.com/plugins/safe-redirect-manager/
https://vip.wordpress.com/plugins/wpcom-legacy-redirector/
https://vip.wordpress.com/plugins/external-permalinks-redux/
And here’s a link to the one I use on sites:
https://wordpress.org/plugins/redirection/
(glance at the number of active installs 400,000+)