How To Mask or Cloak Your Affiliate Links

Discussion in 'Affiliate Programs' started by SportsBikeArena, Dec 26, 2008.

  1. #1
    Affiliate URLs can look pretty messy but with some clever PHP redirect, you can mask the affiliate URL so a visitor doesn't know they are being taken to another site.

    Here's an example:

    1. Open up Notepad and paste the following code:

    < ? php
    header( 'Location: http://www.site.com' ) ;
    ?>

    Change 'site' to your affiliate link to the merchant.

    2. Save this file as Offer1.php or however you want it to display and save it in your root folder of your domain.

    3. Now you can use www.site.com/offer1.php to direct visitors to your affiliate link.

    This was a tip that I learned from Wealthy Affiliate and I just thought to share it here. I've been a member for a little over a week and I must say that I extremely satisfied with the quality of information they have there.
     
    SportsBikeArena, Dec 26, 2008 IP
  2. MelogKnaj

    MelogKnaj Active Member

    Messages:
    233
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #2
    This isn't working for me. Just redirects back to the original page...
     
    MelogKnaj, Dec 26, 2008 IP
  3. markowe

    markowe Well-Known Member

    Messages:
    1,136
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    165
    #3
    Probably you got mixed up with the "site.com" stuff. To clarify, save a file called "offer1.php" in the root of your site, say your site is called cheeseoftheworld.com. IN the file offer1.php, add that header redirect instruction, but instead of "www.site.com" put "www.cheeseaffiliate.com/ABMNBMNB" or whatever link you were given. Now when you access http://www.cheeseoftheworld.com/offer1.php" it will redirect to "www.cheeseaffiliate.com/ABMNBMNB". This will only work online, or on a local server that's running PHP, you can't just run it from your disk. This HAS to work, just follow the instructions carefully!

    Some think that using header redirects is not a great idea, that Google etc. might penalise... Not sure, I think this is a legitimate use, but you should know anyway...
     
    markowe, Dec 27, 2008 IP
  4. MelogKnaj

    MelogKnaj Active Member

    Messages:
    233
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I in fact did not get mixed up. His single quotes should be double quotes if you want the code to work. So it would be,

    < ? php
    header( "Location: http://www.site.com" ) ;
    ?>
     
    MelogKnaj, Dec 27, 2008 IP
  5. markowe

    markowe Well-Known Member

    Messages:
    1,136
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    165
    #5
    Aha, yes, actually it's probably not the single quotes that are the problem, PHP is not bothered either way, it's when you copy-paste from DP, it screws up the quotes. Best to use QUOTE tags, they OUGHT to fix it (?)
     
    markowe, Dec 28, 2008 IP
  6. bobbym

    bobbym Well-Known Member

    Messages:
    1,007
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    128
    #6
    Thank you for the tips. I will try it.
     
    bobbym, Dec 28, 2008 IP
  7. source_lite

    source_lite Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thats weird, double quotes don't work for me. I use singe quotes like this:

    <?php
    header( 'Location: http://www.my-affiliate-link.com' );
    ?>

    Using single quote is the only way it works for me.
     
    source_lite, Jan 11, 2009 IP
  8. markowe

    markowe Well-Known Member

    Messages:
    1,136
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    165
    #8
    Double quotes should work - PHP recognises them, it's probably copy-pasting from DP, you get the wrong sort of quotes. If you type them manually it should be OK. But then it doesn't matter anyway, it's only if you're doing any more serious programming that you start needing to pay attention to the type of quotes you are using.
     
    markowe, Jan 11, 2009 IP
  9. Gamer12

    Gamer12 Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    If you are using WordPress, I have found a plugin that helps to cloak affiliate links. I have download it and using it. It is very easy to use. The author said it is in beta so it is free by the moment. Once it is finalized, it won't be free. So check it out and see whether you find it useful for you or not. The download link is here
     
    Gamer12, Feb 1, 2009 IP
  10. easydolla

    easydolla Peon

    Messages:
    403
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Word bro I use the same thing on my site

    usually ill go with promoting camwithher, instead of refer.ccbill.com/ etc. Ill make a subdomain like cams.mydomain.com n use that code. its a sure fire method to get clicks
     
    easydolla, Feb 1, 2009 IP