How to Hide Affiliate Links

In a previous post I reported that Google is now penalizing pages that have affiliate links on them. I am not going to discuss the pro’s and con’s of this decision right now. Instead, I’d like to offer a quick fix for my downlines and other legitimate affiliate marketers who may be affected by it.

Here’s a simple way to hide those affiliate links so that they are not actually on the pages you want ranked. It involves setting up simple php redirects. I am assuming that you know how to log in to your host site and make simple changes to files there. If not, the person who created your website or blog should be able to do this for you. It takes only a few minutes.

Step 1.  Collect the affiliate urls that you’d like to redirect.

In this example, I’m using URLs for the Renegade system. If you are a Renegade user, substitute your (user) name for ‘UserName’ and you should be good to go.  If you are not a Renegade user, you can put any affiliate URLs in your list. You can also put as many URLs in the list as you like. I happen to use 3 in this example.

  • http://UserName.marketersmanifesto.com/renegadepro/.
  • http://UserName.marketersmanifesto.com/
  • http://UserName.therenegadenetworkmarketer.com/

Step 2. Create a file named redirect.php and put (almost) this code in it.

<?php
$id = $_GET['id'];

$links = array(
"renegadepro" => "http://UserName.marketersmanifesto.com/renegadepro/",
"marketersmanifesto" => "http://UserName.marketersmanifesto.com/",
"therenegadenetworkmarketer" => "http://UserName.therenegadenetworkmarketer.com/"
);
header("Location:".$links[$id]);
exit;
?>

In the code above, remember to substitute your affiliate URLs for mine. In case it isn’t obvious, the affiliate URLs are to the right of the => sign.  Also remember to substitute your id’s for mine. The id’s are to the left of the => sign.

If your website already has a redirect.php file, don’t replace the existing file.  Instead, put this code at the bottom of the existing file.

Step 3. Put the redirect.php script file at the root of your domain.

Once you’ve got your redirect.php file the way you want it, put it in the root directory of your domain. This will be on your hosting site’s server. It’s the same directory as your blog or website’s index.html or index.php file. If you don’t know what this means, you may want to ask the person who set up your blog to put your redirect.php file on your host.

Step 4. Replace the affiliate links on your web pages with the redirects.

Here’s what the Renegade redirects will look like. If you’re a Renegade user, you can use these new links with your domain name substituted for ‘yourdomain’.   Put these new links in place of your old affiliate links.

http://yourdomain.com/redirect.php?id=renegadepro
http://yourdomain.com/redirect.php?id=marketersmanifesto
Http://yourdomain.com/redirect.php?id=therenegadenetworkmarketer

Be careful about case. If your host uses unix, then filepaths are case sensitive. If you name the file ‘redirect.php’ then refer to it as ‘redirect.php’ and not ‘Redirect.php’ or ‘REDIRECT.PHP’.

Step 5. Test

It’s always a good idea to pretend you’re a reader and make sure the altered links still work correctly.

That’s pretty much it. Good luck!

Leave a Reply