Blog

Dear Blog Engage Members, Can We Make History? - http://bit.ly/byLvNt (2 days ago)

How To Mask Your Affiliate Links Using PHP

People stealing your commissions is never cool!

This post is going to walk you through a really neat way of preventing this from happening using a small piece of PHP code.

Let me quickly show you what the end result looks like.

www.fmsseo.com/recommends/KeywordElite

Now doesn’t that link look professional when you compare it with the free link masking URLs.

URL masking using the PHP code method allows you to retain a very nice clean and professional URL and remind others of your website when you post the link on external sites (such as Squidoo and HubPages etc).

To use this method you will need a domain name and you can get one real cheap over at NameCheap.com.

You will also need a hosting account and one of the providers I continually recommend is HostMonster.com.

For this method you will need to create a folder within your selected domain and name it ‘recommends’  (or something else that you choose) as shown in the screenshot below. You can do this directly in your FTP software or on your desktop.

Right Click and Create Folder

1. Right Click and 2. Create Folder

1. Right click on your desktop and
2. Select ‘Folder’.

Name the folder ‘recommends‘ or something else that you wish to use.

Now you’ll need to open up notepad and type the following code exactly as it is shown below.

Redirection Code Using PHP

PHP Redirection Code

Save the document by clicking on ‘File‘ and selecting ‘Save As‘.

Select Save As

Save As

Now name the file ‘index.php‘ shown below (1) and choose ‘All Files‘ as shown (2).

Save As Index.php

1. Index.php and 2. All Files

All you need now is the URL you wish to mask and the name of the URL string that you want to add to the end of your cloaked URL.

For this example, I created another folder inside the ‘recommends‘ folder and named it ‘KeywordElite‘.

New Folder Keyword Elite

Create New Folder - Keyword Elite

1. Recommends Folder

2. Name the folder after the affiliate product (in this case Keyword Elite)

Now, reopen the index.php file you created (and hopefully saved somewhere easy to find such as your desktop).

You’ll need to add the URL that you wish to mask.

Below you can see the code with the URL included that I am going to mask.

Insert The Affiliate Link You Want To Mask

Insert Your Desired Affiliate Link

Save this again as index.php but make sure you select the KeywordElite folder (or the folder for the URL you are masking).

You’re nearly finished.

All you have to do now is make sure that you upload the folder to your hosting account using an FTP client.

You’ll need to place the ‘recommends‘ folder in the root directory.

Upload The Recommends Folder To Your Root Directory

Upload Using Your FTP Client

Follow these steps again for each new affiliate program that you are recommending. Please note: any letter after the main domain is case sensitive, so if you save the folder a ‘Recommends‘ with an upper case R then that is how you must write it down when you create a link on your blog, website, report etc.

This is, for me, the ultimate way to mask your affiliate URL. If you would like to make this even more powerful then I recommend you take a look at Easy Link Manager.

You’ve now discovered how to save your affiliate commissions from being hijacked while promoting professional looking affiliate links.

How do you mask your affiliate links?

To your success,

Karl Foxley

NOTE: Commission hijacking can be done in many ways, in the same way computers can be infected with malware and viruses (search on Google or visit popular affiliate marketing forums and you’ll find lots of information). It can be as simple as you using free software to mask your links and then the site owner (or a hacker) running a script to change all affiliate tags to their own affiliate ID. An affiliate link is an affiliate link no matter what it looks like and a redirection should NOT be used to dupe a visitor.

Karl Foxley - Karl Foxley is an SEO Consultant, Internet Marketer, Business Coach and Co-Founder of FMS SEO. Karl seeks to make SEO and Internet Marketing jargon free for the every day user. Connect with Karl on Twitter or Facebook.


27 Comments


  1. William
    Jan 23, 2010

    Thanks for pointing out this technique.

    By the way, when you refer to commission hijacking, you’re referring to when, if you leave a comment on a blog with an embedded affiliate link that the blog owner would change the affiliate link to his own?
    Digitivity @ The Digital Life & Tools Blog´s amazing last blog ..How to Claim Your Blog on Technorati


    • Karl Foxley
      Jan 23, 2010

      That is not commission hijacking because dropping your affiliate links on to people’s sites is just VERY bad practice.


  2. Larry
    Jan 22, 2010

    Nice article on hiding those links. going to have to do the recommends folder instead of what I’m doing now. Thanks for the heads up.
    Larry
    The Niche Think Tank´s amazing last blog ..31 Days to build a better blog


  3. Dasche Bledsoe
    Jan 09, 2010

    I never even thought of that as ‘commission jacking’, but that’s exactly what that is! Thanks for sharing your wisdom on the matter :)


  4. Toan Nguyen Minh
    Jan 02, 2010

    This article looks very interesting and clean.
    For bloggers who are using Wordpress: Just use Ninja Affiliate or Gocodes to mask your affiliate links ^_^
    Thanks for nice post!


    • Karl Foxley
      Jan 04, 2010

      Hi Toan,

      Those plugins are great but what happens if they stop being supported or they conflict with another plugin and start breaking your site?

      With just knowing this option you can reduce the need for another plugin, always a good thing. :)

      Thanks for taking the time to visit and leave a comment.

      Karl

Leave a Reply

CommentLuv Enabled

Newsletter

Get our latest SEO and Internet marketing articles sent directly to your inbox.
* First Name
* Valid Email
  * = Required Field
Your information will never be rented or sold; we hate spam as much as you do!

Recommendations

Free Traffic And Backlinks!

Do you want free traffic and backlinks? Click here to find out more.

Are You New Here?

If you are new here or even a returning reader, please take a minute to Introduce Yourself so we can get to know you better.