Affiliate URL redirect script

Status
Not open for further replies.

QMcFarlan

My Internet is Broken
Sep 26, 2006
80
0
0
Michigan
I've noticed a few people asking about offer/affiliate redirect php scripts, so I wrote a quick one:

go.php
Code:
<?
/* EvilEmu.com affiliate link forwarding script.
   When a user goes to http://www.yourdomain.com/go.php?key=Keyword,
   this script will forward the user to the link associated with
   the keyword. A .htaccess file is included which will allow
   the links to look like http://www.yourdomain.com/go/Keyword */
$links = array();

/* Set up all of the forwarding keywords and affiliate links.
   Just replace "Keyword1" with the keyword you want to use and
   the URL with the affiliate URL to direct the user to. You can
   add more lines to add as many Keyword/URL combinations as you'd like */
$links['Keyword1'] = "http://www.url1.com";
$links['Keyword2'] = "http://www.url2.com";
$links['Keyword3'] = "http://www.url3.com";
$links['EvilEmu'] = "http://www.evilemu.com";

/* pull incoming key from .htaccess for url search */
$key = $_GET['key'];

// forward user to affiliate
header("location: $links[$key]");
?>
.htaccess
Code:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^go/(.*) /go.php?key=$1 [nc]
 


Status
Not open for further replies.