How To Mask Your Affiliate Links Using PHP

How To Mask Your Affiliate Links Using PHP

NOTE: If you are not comfortable playing around with code and want a very simple solution to link masking try Easy Link Manager for a very low cost solution.

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.

   

About Karl Foxley

       

Karl Foxley is an SEO Consultant, Internet Marketer, Small Business Advisor and Co-Founder of FMS SEO. Karl seeks to make SEO and Internet Marketing jargon free for the every day user.

After Reading This Post Other People Went on to Read:



Do you have something you would like to add? Please take a moment and tell us what you think using our comment form below. All we ask is that you take a moment to read our comment policy.

25 Comments

  1. 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

  2. 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

Trackbacks/Pingbacks

  1. PhilBellamyInc - How To Mask Your Affiliate Links Using PHP - http://bit.ly/4naxVR
  2. 10 Blogging Tips That Improve Your Blog - [...] How To Mask Your Affiliate Links Using PHP – FMSSEO This post is going to walk you through a ...
  3. 20 Blogging Tips and Tools for New Bloggers - [...] How to Mask Your Affiliate Links Using PHP – FMS SEO [...]

Leave a Reply

CommentLuv Enabled