masking affiliate links

3 replies
  • PROGRAMMING
  • |
  • |
this is NOT about masking my affiliate links that I use to sell other peoples' stuff - this is about masking all the affiliate links in a client's affiliate system - he wants them each to go to a URL like this:
www dot hisdomainname dot com - forward slash - theirname

Is there any easy way to do this? I tried domain masking in 1shoppingcart and that didn't work (and maybe I didn't do it correctly). My suggestion was to create subfolders in his domainname folder for each affiliate and then upload his index.html file for the domainname into each subfolder and then set up a custom URL in each affiliate's account. It's a lot of work (he has well over 200 affiliates) and he claims there has to be something easier. Any ideas?

Thanks!
#affiliate #links #masking
  • Profile picture of the author patfl
    Hi,

    using the htaccess + a redirect script that would redir to an url stored in a db or file should work.

    Patrice
    {{ DiscussionBoard.errors[290626].message }}
  • Yes here's the easiest way to do it:

    Put this in your htaccess file

    Code:
    RewriteEngine on
    RewriteRule ^/([^/.]+)/?$ redirect.php?offer=$1 [L]
    Then put something like this in redirect.php


    $offer = htmlspecialchars($_GET['offer']);
    //This cleans offer and makes it safe to use in the database

    /*
    Connect your database and do a query like this:
    */

    $result = mysql_query("SELECT * FROM affiliate_offers WHERE offername = '$offer'");

    $row = mysql_fetch_array($result);

    //Now redirect the user

    header("Location: ".$row['offerURL']);

    Sorry the preg_replace here wouldnt work with the code I had in the codebox! Definitely a bug


    Protip, you cant do a php header if any http output starts. So no white space or html before this code!
    {{ DiscussionBoard.errors[302398].message }}
  • Profile picture of the author HenryFuentes
    In all essence that htaccess would work but what you might be needing is some custom code to fit your current system

    it seems that you are using 1SC as the affiliate management ? if so that would be a bit tricky to accomplish this.

    If you need any help on creating this for your site please let me know and I can take care of this issue for you
    {{ DiscussionBoard.errors[303203].message }}

Trending Topics