FMS SEO
  • Home
  • Blog
  • SEO Services
    • BuilderTrial
    • BuilderPlus
    • OptiBudget
    • OptiPremium
    • OptiCustom
    • White Label SEO
  • Contact Us
    • Write For Us
    • About Us
  • Sitemap
  • Login
Home » Affiliate Marketing » How To Mask Your Affiliate Links Using PHP
Dec22 25
How To Mask Your Affiliate Links Using PHP

How To Mask Your Affiliate Links Using PHP

Posted by Karl Foxley in Affiliate Marketing, Blog, Coaching, Link Masking

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 has written 127 post(s) for FMS SEO.

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.

  • View all posts by Karl Foxley →
  • Blog

25 Comments

  1. William | January 23, 2010 at 1:07 pm

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

    Reply
    • Karl Foxley | January 23, 2010 at 1:43 pm

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

      Reply
  2. Larry | January 22, 2010 at 3:41 pm

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

    Reply
  3. Dasche Bledsoe | January 9, 2010 at 12:37 am

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

    Reply
    • Karl Foxley | January 9, 2010 at 12:01 pm

      I’m glad you’ve found the guide useful Dasche.

      Reply
  4. Toan Nguyen Minh | January 2, 2010 at 2:21 am

    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!

    Reply
    • Karl Foxley | January 4, 2010 at 6:01 am

      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

      Reply
  5. Chandan | December 27, 2009 at 5:46 am

    Thank you for sharing this nice information.
    .-= chandan´s amazing last blog ..Sponsored tweets- great work at home opportunity =-.

    Reply
    • Karl Foxley | January 4, 2010 at 6:04 am

      You’re welcome Chandan.

      Reply
  6. Murk Core | December 25, 2009 at 1:31 pm

    will it be possible to do this with a sub-domain blog?
    .-= murkcore´s amazing last blog ..The Storm, Picturesque – Hours (2009) – Progressive Metalcore/Hardcore =-.

    Reply
    • Karl Foxley | January 4, 2010 at 5:59 am

      Hi Murk,

      If you own the sub domain then yes as you will need access to the server.

      Karl

      Reply
  7. Deepika | December 24, 2009 at 12:14 pm

    Hi Karl,

    You have shared a very useful information needed for bloggers. apart from Easy Link Manager is there any other tool?
    .-= Deepika´s amazing last blog ..SEO – True Story =-.

    Reply
    • Karl Foxley | December 24, 2009 at 12:42 pm

      Hi Deepika. The cheapest one on the market, but still very good at what it does, is PHP Link Cloaker.

      Hope that helps,

      Karl

      Reply
  8. Dennis Edell | December 24, 2009 at 9:00 am

    Does this work with the plugins out there like ninja affiliate or separate?

    Reply
    • Karl Foxley | December 24, 2009 at 9:08 am

      Hey Dennis, I have GoCodes on my server running from the /go/ folder and I use the PHP method above from the /recommends/ folder so I can’t see any problems with using this alongside any dedicated software.

      Example:

      http://www.fmsseo.com/go/elite

      and

      http://www.fmsseo.com/recommends/KeywordElite

      Hope that helps,

      Karl

      Reply
      • Dennis Edell | December 25, 2009 at 11:50 am

        Perhaps a post of the GO system then…do they do anything special for ya, etc…

        Reply
        • Karl Foxley | December 25, 2009 at 12:18 pm

          I wrote about GoCodes WordPress plugin here http://www.fmsseo.com/222/affiliate-link-masking-wordpress-plugin/

          Reply
  9. dragonblogger | December 23, 2009 at 9:21 am

    RT @extremejohn: RT @karlfoxley: How To Mask Your Affiliate Links Using PHP http://bit.ly/8tCp5L

    Reply
  10. extremejohn | December 23, 2009 at 9:20 am

    RT @karlfoxley: How To Mask Your Affiliate Links Using PHP http://bit.ly/8tCp5L

    Reply
  11. Extreme John | December 23, 2009 at 9:20 am

    I have been looking for something like this for our MMA blog, woot! Thank you, Sunday Smash bound.
    .-= Extreme John´s amazing last blog ..10 Reasons I Wouldn’t Copy Your Article =-.

    Reply
    • Karl Foxley | December 23, 2009 at 9:25 am

      That’s awesome John.

      Reply
  12. James M. | December 22, 2009 at 8:54 pm

    I always thought that the programming behind link masking is very complicated. Thanks, you made it look very simple.

    I’m heading over to Easy Link Manager and see if they have a trial version, so I could check out how good it really is. :)
    .-= James M.´s amazing last blog ..Track Cell Phone =-.

    Reply
    • Karl Foxley | December 22, 2009 at 9:05 pm

      Easy Link Manager is a great little tool and is quite a bit cheaper than PowerLinkGenerator.

      Reply
    • Hesham | December 23, 2009 at 9:03 pm

      I agree, you made it very simple, I could never have thought about this!
      .-= Hesham @ FamousBloggers´s amazing last blog ..How to add more URLs to your CommentLuv plugin account? =-.

      Reply
      • Karl Foxley | December 24, 2009 at 9:13 am

        Thanks Hesham.

        Reply

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 [...]
  4. Alltop SEO - How To Mask Your Affiliate Links Using PHP http://bit.ly/6dOVGD SEO.alltop.com

Leave a Comment Cancel reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badgeShow more posts

Recent Topics

  • Six Rules for Finding a Great Domain Name
  • Link Building Services – Are You Using One?
  • 7 Ways to Keep Your Link Profile Natural
  • Should Internet Marketing Be Taught in High School?
  • Improving the SEO of Every Website that You Personally Design

Topic Categories

  • Affiliate Marketing
  • Affiliate Networks
  • Analytics
  • Bing
  • Blog
  • Blogging
  • Coaching
  • Conversions
  • Email Marketing
  • Facebook
  • Free Software
  • Free Stuff
  • General Blogging
  • Google
  • Internet Marketing
  • Joint Ventures
  • Keyword Research
  • Link Building
  • Link Masking
  • Online Coaching
  • Plugins
  • Product Launches
  • Productivity
  • Scripts
  • Search Engine Optimisation
  • SEO
  • Social Media
  • Themes
  • Tools
  • Traffic Generation
  • Traffic Generation
  • Twitter
  • Website Design
  • Wordpress
  • Yahoo

Recent Comments

  • Cristian Balau on Six Rules for Finding a Great Domain Name
  • Interview With Gera From SweetsFoods Blog on Have You Met Ileane Smith from Basic Blog Tips?
  • E.McBride on Six Rules for Finding a Great Domain Name
  • joanne Carter on WordPress Banner Rotator Plugin Ad Squares Affiliate Widget
  • Anthony Walker on Blog Commenting For Traffic Generation

About FMS SEO

FMS SEO specialise in search engine optimisation for UK businesses. Our bespoke packages are tailored exactly to your website, the industry you operate and your target audience. FMS SEO get you quality inbound links; guaranteed!

From the Blog

  • Six Rules for Finding a Great Domain Name
  • Link Building Services – Are You Using One?
  • 7 Ways to Keep Your Link Profile Natural
  • Should Internet Marketing Be Taught in High School?
  • Improving the SEO of Every Website that You Personally Design

Blog Discussion

  • Cristian Balau on Six Rules for Finding a Great Domain Name
  • Interview With Gera From SweetsFoods Blog on Have You Met Ileane Smith from Basic Blog Tips?
  • E.McBride on Six Rules for Finding a Great Domain Name
  • joanne Carter on WordPress Banner Rotator Plugin Ad Squares Affiliate Widget

Get in Touch!

You can contact us here.

© 2011 FMS SEO | Designed by Elegant Themes | Hosted with Host Monster | Login