Creating affiliate links for referrers

Discussion in 'HTML & Website Design' started by Nathan Mclean, Jun 8, 2013.

  1. #1
    Hey guys I'm new to the forum so whats up from Scotland :)

    I have my own website (which I didn't build) and it's basically a lead generation site for my business.

    An opportunity has come up to work with some affiliates/referrers and I need unique URL's for them so I know that they brought the client to the site.

    If my home page is www.example.com and Mr Smith is my affiliate I would like the URL Mr Smith uses to be something like 'www.example.com/mrsmith' but the URL should redirect to the homepage for the user to decide if they would like our services.

    How can I do this?
     
    Nathan Mclean, Jun 8, 2013 IP
  2. aidanriley629

    aidanriley629 Banned

    Messages:
    429
    Likes Received:
    23
    Best Answers:
    3
    Trophy Points:
    175
    #2
    you can do this with php headers. on www.example.com/mrsmith have this code

    <html>
    <?php header('Location: http://example.com/');
    exit;
    ?>
    </html>
    Code (markup):
     
    aidanriley629, Jun 8, 2013 IP
  3. Nathan Mclean

    Nathan Mclean Member

    Messages:
    86
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    45
    #3
    Does this mean I just have to create a new file on my server and call it mrsmith.php ?
     
    Nathan Mclean, Jun 8, 2013 IP
  4. aidanriley629

    aidanriley629 Banned

    Messages:
    429
    Likes Received:
    23
    Best Answers:
    3
    Trophy Points:
    175
    #4
    well, all of that can be scripted. It depends how you want to do it, if many people will be using it then you'll want to code it. I can help
     
    aidanriley629, Jun 8, 2013 IP
  5. Nathan Mclean

    Nathan Mclean Member

    Messages:
    86
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    45
    #5
    I'm totally broke mate but thanks for the help!!
     
    Nathan Mclean, Jun 8, 2013 IP
  6. aidanriley629

    aidanriley629 Banned

    Messages:
    429
    Likes Received:
    23
    Best Answers:
    3
    Trophy Points:
    175
    #6
    No, I wasn't going to charge you. I will do it for free.
     
    aidanriley629, Jun 9, 2013 IP
  7. Nathan Mclean

    Nathan Mclean Member

    Messages:
    86
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    45
    #7
    wow, really? why? that would be great man... :D
     
    Nathan Mclean, Jun 9, 2013 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #8
    I would use getData for that -- rather than playing stupid games with redirects and wasting time on extra handshakes. (which REALLY seems to be a sick time-wasting bandwidth wasting fad right now.)

    Just have it something like:
    example?referrer=mrSmith

    then in the PHP you can just trap:

    $_GET['referrer']

    To get the value of where it came from.

    You could also use $_SERVER['HTTP_REFERER'] to find out the URL that sent to your page, then you'd not even need a fancy URL for it.

    Seriously, what the devil is with all these people wasting the extra handshake and server overhead on using header/location? Is there some dumbass tutorial or new book written by some ignorant twit promoting that or something? I've seen it in dozens of posts within the past two weeks when I'm used to that being called something NOT to do.
     
    deathshadow, Jun 9, 2013 IP