Hello, I need help on creating a redirect script. Now, I'm very detailed to make sure I don't leave any un-answered questions, so here goes...
I need a script that will redirect people in the following way....
Suppose you're an affiliate and you want to promote several differnt products of mine.
Your typical affiliate link looks like this:
http://www.example.com/cgi-bin/affil...cgi?aff=USERID
I already have a script that shortens this down to look like this:
http://www.example.com/g.o/USERID
The only problem is if an affiliate wants to promote any different product than the default, then they have to enter the FULL URL after their USERID and the link looks like this:
http://www.example.com/g.o/USERID/ht...ateWidget.html
So the syntax for the script above goes like this:
http://www.example.com/g.o/USERID/URL
You get what I mean, right? By the way, that g.o file is a perl scrip. I modified the .htaccess file on my server to treat .o extensions as perl scripts.
So what I want is a seperate script, maybe called "t.cgi" or "t.php".
The syntax should look like this:
http://www.example.com/t.php/USERID/PID
The USERID is the username of the affiliate and the PID is the product ID.
Within the script, I should be able to add as many Product ID's and have the script simply add it to the link it will redirect to.
So let's suppose that for Product ID "3", I have it set to redirect to "http://www.othersite.com/golfclubs.html".
Then somewhere in the script, you should leave an area for me to enter a new product ID and the URL it should go to.
When the affiliate promotes the link that looks like this:
http://www.example.com/t.php/USERID/3
Then the script should automatically go to the following link:
http://www.example.com/g.o/USERID/ht...golfclubs.html
However, if an affiliate doesn't enter a product ID, the the script should simply forward them to the default script as long as it inserts their USERID.
In other words, if an affiliate simply promotes:
http://www.example.com/t.php/USERID
The script should redirect them to:
http://www.example.com/g.o/USERID
But if they do add a product ID number after wards, like this:
http://www.example.com/t.php/USERID/PID
Then the script should check within itself to see what the URL for that product ID is and then should redirect using the following syntax:
http://www.example.com/g.o/USERID/URL
Does all this make sense?
Please let me know if we can build it right here to share with anyone else that might need a little script like this.
Sincerely,
Jaime Ojeda