Help With PHP Tracking Using .htaccess

Discussion in 'Affiliate Programs' started by yeahdisk, Feb 3, 2008.

  1. #1
    Hi all,

    I'm trying to get this to work in my .htaccess:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^test/([A-Za-z0-9\.\_\-]+)?OVRAW=([A-Za-z0-9\.\_\-]+)/&$ /test.php?to=$1&kw=$2 [L,NC]
    </IfModule>

    Essentially, I want to be able to strip out 2 pieces of info and pass them to a .php file (test.php in the above example) which will in turn redirect users to my affiliate links.

    What I'm trying to do in the above code is:

    1) My Affiliate Link mydomain/test/sony is the destination URL for my PPC ads
    2) User clicks on paid ad and arrives at .htaccess with mydomain/test/sony?OVRAW=foo&OVKEY=bar...
    3) My .htaccess takes the bit after test (sony) and passes it to test.php using variable 'to'
    4) My .htaccess also takes the OVRAW portion (foo) and passes it using 'kw'

    Now I'm not a PHP wizard, but I thought the above piece of code should get me there, but it isn't.

    Can anybody provide an answer on what I might be doing wrong? I've spent the afternoon trying to learn about PHP syntax but i'm close to admitting defeat on this one.

    Thanks all
     
    yeahdisk, Feb 3, 2008 IP
  2. Tommy Arnold

    Tommy Arnold Active Member

    Messages:
    525
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
    #2
    I have a click tracking script i built i can send it to you if you want for free

    play.php?site=1 pulls an affiliate link from a database and tracks the users ip, before sending to the affiliate url

    Is this what you wanted

    Im confused as to why you would need htaccess
     
    Tommy Arnold, Feb 3, 2008 IP
  3. yeahdisk

    yeahdisk Peon

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Probably because I'm such a massive noob.

    thanks for your help, I'd love to take a look at your script!

    I've PMed you
     
    yeahdisk, Feb 3, 2008 IP