Internet marketing and publishing

About impNERD

impNERD is the place to find information on internet marketing, publishing and tips for web development. Read more »

Twitter FriendFeed

Receive Updates

Receive updates via RSS
What is RSS?
Receive a SEO eBook FREE.

How to Hide Affiliate Links

The income potential for affiliate marketing is virtually unimaginable. Sites surrounded by affiliate links have been around for ages, which is why Google has become wary of such practices.

Many webmasters in their quest for the uber-affiliate site post small snippets of a product, slap on a link then move onto the next–Google frowns upon this activity. Once Google finds the site as an affiliate marketer the site is devalued or even banned from its index, which is one of the reasons why blogging about affiliates has made its way into the main stream. Bloggers have found that writing about one product with original content is bringing more sales than previous practices.

Because of this, affiliate marketing is becoming a popular fixture amongst bloggers as a way to create money. They are discovering the power affiliate marketing has to bring; which is why it is ever so important to know what is working and how to improve on sales while keeping friendly with the internet beast, Google. One way by doing this is creating a way to link to affiliate links without showing the actual link.

For the examples I will be using www.affiliate.com/?ref=123 as the affiliate link and www.yourdomain.com/go/affiliate.htm as the page you want to link to before redirecting to the affiliate.

Meta Refresh

While meta refreshes generally cause problems for search engines and seen as bad practice, the noindex,nofollow tells them not to index it or follow the link thus not creating such problems. The content is refreshed to the affiliate web page in 1 second, giving the bots time to see the noindex,nofollow tag and for your analytics code or other tracking programs to run.

This code should be placed within a text file then saved as affiliate.htm and uploaded to the /go/ directory. Whenever you want to link to the affiliate, just link to /go/affiliate.htm

<html>
<head>
<title>Affiliate</title>
<meta name="robots" content="noindex,nofollow" />
<meta http-equiv="refresh" content="1; url=http://www.affiliate.com/?ref=123" />
</head>
<body>
<p>You are being taken to the correct page.
<br />If the page does load after 5 seconds,
<a href="http://www.affiliate.com/?ref=123">click here</a>.</p>
</body>
</html>

PHP 301

The PHP 301 is pretty simple, it tells the server the page has moved to another location, then sends the page to Location:, which happens to be the affiliate page; it is done instantaneously. The problem though is that this does not allow you to track the page using JavaScript tracking scripts like Google Analytics.

To use the PHP 301, just save it as affiliate.htm and upload it to /go/affiliate.htm

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.affiliate.com/?ref=123");
exit();

.htaccess 301

Another simple implementation for affiliate redirects is the .htaccess 301 redirect. This code tells the server that /go/affiliate.htm should be redirected to affiliate.com/?ref=123. No extra files are needed, just upload this script and whenever you want to link to affiliate.com/?ref=123 just link to /go/affiliate.htm. If you know much about .htaccess you can create wildcards for affiliates, making a pretty cool/badass affiliate link system.

Redirect 301 /go/affiliate.htm http://www.affiliate.com/?ref=123

JavaScript redirect

The JavaScript redirect is similar to the meta refresh as you can run scripts before the code executes allowing you to track it. The code tells the browser that the page is located somewhere else and sends the browser there.

<script type="text/javascript">window.location="http://www.affiliate.com/?ref=123";</script>

Other Advantages

Although these methods will help you stray away from Google’s wrath on affiliate marketers, it is also a great way of increasing click-throughs for such links. Visitors are known to not click on long uris or uris which have GET modifiers, so by using a redirect, they won’t have to.

Written: Sep 19, 2007
Tags: , ,


7 Responses to "How to Hide Affiliate Links"

  • Jeremy Porter
    September 22, 2007 @ 4:04 am
    | Reply

    Very good blog on affiliate links.

  • jon
    September 24, 2007 @ 6:05 am
    | Reply

    or you could use TinyURL right?

  • Bill
    December 24, 2007 @ 8:29 am
    | Reply

    This website is Great! I will recommend you to all my friends. I found so much useful things here. Thank you.

  • Carnival of Webmasters, Seventh Edition - Your Website Profit
    January 13, 2008 @ 3:53 am
    | Reply

    [...] How to Hide Affiliate Links - Gary R. Hess Affiliate marketing is becoming a popular fixture amongst bloggers as a way to create money. They are discovering the power affiliate marketing has to bring; which is why it is ever so important to know what is working and how to improve on sales while keeping friendly with the internet beast, Google. One way by doing this is creating a way to link to affiliate links without showing the actual link. [...]

  • Mike
    October 23, 2008 @ 5:43 pm
    | Reply

    Make sure you save the file as .php if using the php 301 trick. Otherwise it won’t work if saved as HTML

  • Gary R. Hess
    October 23, 2008 @ 6:33 pm
    | Reply

    @Mike it will work if you have Options +Includes set to .html. But you are right, for the most part people don’t and should have it saved as a .php

  • Gary Hess
    September 24, 2007 @ 10:55 am
    | Reply

    No, not exactly. Although TinyURL would be better than regular affiliate links, it wouldn’t be as good as the other options I listed. There is a nice percentage of people who don’t like clicking on external links, thus TinyURL is not a choice. Also, as TinyURL is getting more and more popular, people are getting more afraid to click on the links due to possibilities of what the link might actually be. You actually lose trust by using TinyURL in most cases.

Leave a Reply