The htaccess file is a fine method (there's 3 ways to do anything as you know). But remember to always keep an updated backup of your htaccess file when using that method. That way if you lose your hosting or something nuts, you won't be scrambling to fix dead affiliate links all over the place. An obvious point as you should back up ALL files, but that one is often forgotten in the process...