You may have noticed already, but I use redirect pages when I link out to different programs. Some of those programs are affiliate links, but not all of them. I will use these redirect pages for almost all the links out for advertiser programs, for three main reasons.
Not all the links are affiliate links, but some are. Affiliate links are often formed in a way that the affiliate information is easy to derive from the address. These parts can easily be stripped if someone doesn’t want you to receive the commissions that are associated with that. While I don’t like it when people do that (it won’t make it cheaper for you in any way), I don’t care about the people who do it. I care about the software that does that.
There is malicious software out there that hijacks affiliate links, stripping my affiliate-id and replacing it with the id of someone else. This is what I really don’t like, because the intentions of the visitor are good, but they and I are harmed by someone with malicious intent.
As far as I’ve been able to find this happens by software on the visitors pc. But there are also reports about hacked websites, where files and links have been replaced. Serious stuff!
The outbound (affiliate) links are all placed inside a nice little folder on my server. If a program decides to change the structure of their affiliate link (I know TLA did this once) I can simply go to that folder, modify the appropriate file and all my links are okay again.
This is also a benefit in case you might want to sell you blog at one point. Not all affiliate accounts are transferrable, and for the ones that aren’t you (or the new owner) can simple replace the affiliate links in the redirects and the entire archive of posts links to the new affiliate id. Easy as pie!
It’s feasible that I change my mind about a program, or have other reasons to not wanting to link out to a program any longer. In that case I can easily replace the redirect page, with another page with the same name, explaining all the reasons why I don’t promote that program anymore.
It’s the easy opt-out. I want out, but I don’t want to go back through all my articles to find where I linked to that particular program (would take hours). I simply replace it with another page (which would take minutes).
There are several methods to choose from, but there are two methods that I will describe here:
This is not really hard to do. What you need is a simple text editor and FTP access to your server.
Step 1: Open the text editor, and copy paste the following template in there.
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>[INSERT PAGE TITLE HERE]</title>
<meta name="robots" content="noindex,nofollow">
<script>window.location="[INSERT AFFILIATE URL HERE]";</script>
<meta http-equiv="refresh" content="1; url=[INSERT AFFILIATE URL HERE]">
</head>
<body>
<p align="center">You are being taken to the correct page.
<br>If the page does load after 5 seconds,
<a href="[INSERT AFFILIATE URL HERE]">click here</a>.</p>
</body>
</html>
Step 2: Insert the correct links and save.
Replace the [INSERT ... HERE] placeholders with the appropriate content. After that save the document as a .html or .php file.
Step 3: Upload the file to the server
Start your FTP-program (I use FileZilla) and upload the file to your server.
Step 4: Link to it.
That’s it, now use that link instead of the original link. You could even add the rel=nofollow attribute to the link to tell search engines that they need not follow the link (but a lot of them do it anyway).
Editing the .htaccess file can make your website inaccessible if done incorrectly. Always make sure you have a back-up of the current version of the .htaccess file, to go back to a working version.
.htaccess is a file on Apache servers. It’s a very powerful tool, but often requires rather detailed technical knowledge to edit. Thankfully it’s not that difficult for the purpose of redirecting pages on server level.
Step 1: Check for existing .htaccess
First you need to find out whether you have a .htaccess file already. Start your FTP-program (make sure your program shows the .htaccess file), browse to the root of your domain and look for it (it’s usually on top of the list). If it’s there, download it. Make sure to make a back-up of the current file!
Step 2: Edit it to add redirects
Open the .htaccess file in a text editor and add the following lines to the file.
# Temporary redirects for affiliate links
Redirect 302 /[subdir]/[filename] http://example.com/?id=12345
Redirect 302 /[subdir]/[filename] http://example.com/?id=34567
# End of affiliate redirects
Now replace /[subdir]/[filename] with the right link, and replace http://example.com/?id=12345 with the address you want to send your visitors to when they click the link.
Make sure you use a temporary redirect. The status code 302 tells the other server that the page is redirected temporary, and that they should not update their addresses to the new address.
For example, for my e-junkie affiliate link this looks like this:
Redirect 302 /go/e-junkie.php http://www.e-junkie.com/?r=11261
Step 3: Save and upload
Upload and overwrite the old .htaccess file on the server.
Again make sure you have a back-up of the old version before you do this!
Step 4: Link to it.
That’s it, now use that link instead of the original link. It doesn’t even matter if there’s a file or not on the original location.
If you’re using WordPress as your (self-hosted) blogging platform, you could also use Joost de Valk’s plugin Robots Meta to edit the .htaccess file from within the WordPress admin interface.
Again, use caution with this file. Make sure you have a copy of a working version and ftp-access to your server in case things go wrong. An error in the .htaccess file could effectively deny you access to the WordPress Admin interface. In which case you’ll have to replace the erroneous file with the back-up through FTP.
Redirecting your affiliate links is not a sneaky trick, it’s a legitimate way to protect yourself and your visitors from the effects of malicious software that targets those links. Using the .htaccess method is preferred, because it’s not discouraged by search engines.
Nothing is entirely safe, because there are always ways to hack a site. But using this method, you’ll eliminate that 80-90% of causes. If you make sure you protect your .htaccess file properly too, you’re well on your way to being safe.
While I may be hiding protecting my affiliate codes, Scraping Pennies still gives full transparency about it. That’s what this blog is all about, making money online and showing how I do it. Subscribe now, to stay on top of tricks and tips like these. It might just make you a couple of pennies, heck a dime even!
If you don't put your two cents in, how can you get change?
Excellent article Lode, I do this same thing with some links like Amazon affiliate links. Then I can link to mysite/cd/the-name instead of amazon.com/%2340lkdfj
Nice
AskApaches last blog post..Fast and Easy Custom WordPress New User Registration
[...] the .htaccess file can make your website inaccessible if done incorrectly. Always make sure you have a back-up of the current version of the [...]
Thanks AskApache! Your site is my primary reference for .htaccess info, a great help in understanding what I’m doing (and making sure the blog stays up!).
I’ve been struggling with rewrite rules a while back, but that’s a bridge too far for me (at least for now). Maybe I’ll look into it some other time.
Thanks for stopping by!
If you’re using a Wordpress, why not use a Wordpress plugin to manage all that for you.
I use link-cloaking-plugin – from here: http://w-shadow.com/blog/2007/07/28/link-cloaking-plugin-for-wordpress/
It’s simply set to cloak everything on my site, makes the site looka lot tidier (which is why I use it). You can, if you wish, set it to manual and just type in a small code whenever you want to cloak one link.
Also, you get to choose the name that the link appears to go to, e.g. /goto/
Personally I feel that PHP redirect scripts are the best way to go with affiliate links.
Great resource. One question, though. For the commenter, htaccess redirect, he mentions PHP redirect scripts…I’m experimenting with that now. Is there a way to place a “nofollow” attribute in the .php file itself?
The initial file looks something like this:
Is a “nofollow” even needed? I don’t want to put the nofollow in the link, but the file above. I think if I put the nofollow in the link, I “lose” some of my internal linking…
@Bill,
Check out http://www.askapache.com/seo/advanced-http-redirection.html for an example php file… Keep in mind that each time a request/redirect is handled by PHP, it has to load the entire php binary just to send a simple redirection… .htaccess/server-side is definately better in that way, but php is a little more flexible and I also use it for redirects occasionally.