I offered a simple solution to redirecting affiliate links using .htaccess previously now heres one using good old faithful PHP.
Save the following code as a .php file, naming it is your choice. (For the example it is called link.php).
$path = array(
'link-1' => 'http://www.aterriblelongaffiliatelinkhere.co.uk',
'link-2'=> 'http://www.anotherterriblelongaffiliatelinkhere.co.uk';
if (array_key_exists($_GET['id'], $path)) header('Location: ' . $path[$_GET['id']]);
?>
replace the ‘link-1′ etc with a keyword describing where the link is going and also the corresponding URL of the affiliate link, when you add more than 2 links make sure the last link doesn’t have the comma after it.
Upload to the root of your website
Now if you go to www.yoursite.co.uk/link.php?id=link-1 it will redirect to ‘http://www.aterriblelongaffiliatelinkhere.co.uk
If you want to clear that up even more
Put the following lines in your .htaccess file
RewriteEngine On
RewriteRule ^go/([/_0-9a-zA-Z-]+)$ link.php?id=$1
Now if you go to www.yoursite.co.uk/go/link-1 it will have the same effect as above.
This works fine for any website using affiliate links, that includes Wordpress. I use this method to keep the number of plugins I install down to a minimum.
Hope it is of some use.
So you’ve installed Wordpress, chosen or tweaked a template design, written that amazing original content that users will want to flock to your site to read, then your done, right? NO, you have only just started. Wordpress is pretty impressive “straight out of the box” for seo friendliness but still needs some tweaks to get the best out of it, especially with regards to that thawny issue of duplicate content. Lucky for you Joost de Valk (a favourite blogger of mine) has written a very comprehensive guide including which plugins may/will help you with your quest for SEO supremacy, find the definitive guide to Wordpress SEO here
Enjoy 
There is quite a lot of talk around hiding, redirecting or cloaking affiliate links at the moment and if it is a good or bad idea from an SEO, will I get penalised by google perspective.
What we mean is turning a www.merchantwebsite.co.uk/en/category?aid=1234432234 link into www.yourwebsite.co.uk/product
Reasons for doing this are, visitors are more likely to click the link if it is pointing to your domain name instead of somebody elses, it looks more tidy and is easier to remember.
There are quite a few ways of doing this but my favourite is via htaccess
add the following line to your .htaccess file
Redirect 301 /productname http://www.affiliatewebsite.com/?aid=32134
in the above example www.yourwebsite.co.uk/productname will redirect to www.affiliatewebsite.com?aid=32134
How simple is that and all updateable from one file.