How to Redirect a Link to Your Amazon Associates ID

by Michael on September 3, 2012 · 4 comments

If you have an Amazon Associates account, you might be wondering about the best way of managing your links. Sure, you could create a different link for every product, but that quickly gets unwieldy. Surely there’s a better way. Right?


Wouldn’t it be nice to feed the product ID into a standard link and let your web server craft the link for you?

What I’m talking about here, of course, is creating a redirect for your Amazon (or other) affiliate links. If you’re using WordPress to run your site, you could use a plugin to manage your affiliate redirects. But, as I’ve noted before, I don’t like using plugins for things that can be easily achieved with a bit of custom code.

What happens if the plugin’s creator loses interest and stops updating? It happens. And if it happens to you, you’ll be stuck with a huge cleanup project on your hands. Not worth it when you can roll your own solution in less time than it takes to find and install a plugin. Plus, the method outlined here works for just about any backend, not just WordPress.

The simplest solution (in my book) is to create a PHP redirect. To do this, create a .php file (i.e., just a text file containing a bit of PHP code) with the following:

<?php
$asin = htmlentities($_GET['asin']);
$link = "http://www.amazon.com/exec/obidos/ASIN/".$asin."/ref=nosim/jammersix-20";
header("Location:".$link);
?>

(sorry about the awkward line wraps)

Be sure to replace “jammersix-20” with your own affiliate ID — or don’t, if you’re feeling generous. ;-)

I named this file amazon.php and stashed it in /external at the root level of the domain. Thus, to use it, I simply link to:

http://www.jammersix.com/external/amazon.php?asin=xxxxxxxxxx

If you replace xxxxxxxxxx with the actual Amazon product ID number (ASIN = Amazon Standard Identification Number) the redirect will produce a well-formed Amazon link with your Associates ID that points to the product of interest.

The end product will look like this:

http://www.amazon.com/exec/obidos/ASIN/xxxxxxxxxx/ref=nosim/jammersix-20

For example, this link:

http://www.jammersix.com/external/amazon.php?asin=1430232498

results in an Amazon link that points to a handy book about PHP solutions for dynamic web design. The end product looks like this:

http://www.amazon.com/exec/obidos/ASIN/1430232498/ref=nosim/jammersix-20

Go ahead, click both versions. They work exactly as advertised.

Wondering how I found the ASIN? The easiest way is to just look at the page url after you’ve navigated to the product of interest. You’ll see it embedded in the Amazon url right after /dp/.

The beauty of this approach is that: (1) you’re not dependent on a third-party developer, and (2) if you ever change your affiliate ID in the future (or if Amazon changes the acceptable link structure) you only have to update it in one place.


{ 4 comments… read them below or add one }

Erica September 6, 2012 at 2:01 pm

Thanks for the tips. I use a redirection plugin which allows me to create a link using my own url. This way if they change the structure I just go in the back office and change the link that it directs to.

Reply

www.athletenewswire.com July 25, 2014 at 7:16 am

Undeniably believe that which you stated. Your favorite reason seemed to
be on the internet the simplest thing to be aware of. I say to you, I definitely get annoyed while people think
about worries that they just do not know about.

You managed to hit the nail upon the top and defined out the
whole thing without having side-effects , people
could take a signal. Will likely be back to get more.
Thanks
http://www.athletenewswire.com

Reply

http://ericasglamour.com/the-venus-factor-reviews-cutting-through-the-hype/ July 29, 2014 at 2:00 pm

Sun is really fruitful in Aries Ascendant due
to Panchmesh Trikonapati. Try to make good harmony in your home otherwise
it can cause some denigrate in your image. Even without the aid of the blatant title, the figure is
obviously Venus in her classic pose, with ankles slightly crossed and arms outstretched above her head.

Reply

how do you email text messages July 30, 2014 at 3:21 am

With this, you need to have very good skills and along with that good power of understanding as wll to grab the explanatioons of
your employer as effectively and at one shot possibly.
“Many individuals in real estate and the mortgage industry are actually self-employed working within a brokerage structure and they don’t have a dedicated marketing arm to support them,” she pointed out.
And the company that iss revolutionizing the healthcare communication industdy is Rocket Thought Marketing.

Reply

Leave a Comment

Previous post:

Next post: