How to Create an Affiliate Redirect Script Easily Using PHP Code


This is an easy guide to create your own “pretty affiliate URLs” using a simple affiliate redirect script in PHP.
First of all, let’s take a look at the desired effect. For this example, I’m going to use a nice Legal Form Generator affiliate URL I often share:

http://www.nitroshoppingcart.com/app/?af=1268050

Notice the URL is complex. It’s hard to say it in an audio recording, or even for a prospect to remember it.
Rather than give out this complicated URL, I simply share a “pretty affiliate URL” that looks like this:

http://jimyaghi.com/recommends/legal

Tidy, isn’t it? You can create your own on your domain using the following recipe.

Requirements:

  1. A domain name (your current website domain will do)
  2. A hosting account (your website is fine for this too)
  3. FTP access to your server so you can transfer files
  4. A text editor like Microsoft Notepad or Mac TextEdit
  5. At least ONE Affiliate URL

Directions:

1. Open your text editor and copy the following PHP script exactly to a new file:

<?php header('Location: http://www.nitroshoppingcart.com/app/?af=1268050'); ?>

2. Replace the demo URL with your own affiliate URL, making sure not to remove the single quote in the code.
3. Save the file to your Desktop with the name ‘index.php’ (without quotes).
4. Open your FTP client (BestFtp 2000 or WinSCP is good)
5. Connect to your server’s home directory. Usually /public_html or just /html.
6. Create a new directory called ‘recommends’ (without quotes).
7. Browse to the ‘recommends’ directory
8. Create a new directory called ‘legal’ or whatever you want to refer to your affiliate program as. It doesn’t matter what you put here, as long as it’s a unique name.
9. Browse to the ‘legal’ directory.
10. Once inside, upload the index.php file on your desktop to the open directory. This copies the file index.php to http://yourdomain.com/recommends/legal/
You’re done!
Now you can test this by browsing to http://yourdomain.com/recommends/legal
Of course, if you used different directories, you would need to replace my demo URL with the path you used.
You can add as many affiliate products as you want in the same way. Just create new directories inside the ‘recommends’ directory and upload index.php files to them.
The file “index.php” is the default file accessed when someone browses to the directory you specify. Share your pretty affiliate URL with your prospects and all sales that access your pretty link from now on will be tracked to you.
Please Note: if you don’t have PHP installed on your server, you may need to use the  Affiliate Link Javascript Redirect or Affiliate Link HTML redirect with Time Delay versions instead.
~jim
P.S. for more tricks like this, check out the YaghiLabs Internet Business Academy at…

 http://jimyaghi.com/ylacademy

 
 

Jim Yaghi

Jim Yaghi

Foremost Home Business traffic expert, Jim Yaghi is a Computer Scientist and Mathematician who used to build search engines for a living. At 16 he created a mildly popular social network and has been an online entrepreneur for over 15 years. In 2006 he rose to the #1 Affiliate rank in many Home Business programs (most notably Magnetic Sponsoring). Today he's best known for hatching the first industry-wide viral campaign to reach all major social networks, for hosting a top-10 Internet radio show for entrepreneurs, and for shattering industry sales records with his best-selling, easy-to-follow online marketing courses PPC Domination, PPC Supremacy, and Traffic KickStart.

Login

Fill your credentials below to access your YaghiLabs Learning Center account...

For the fastest way to build and grow an online business from scratch, download the... "Just Getting Started" Guide to Endless Free Leads & Traffic

Join our newsletter below, and as a gift, you’ll get this 4-page action plan to organically build an internet-based information selling business with nothing but free traffic!

“By clicking ‘Get Started I agree to receive daily emails from Jim Yaghi containing online marketing tips and advice. I accept these emails are written to help me sample and learn how YaghiLabs products & services can help me better advertise online. I also understand that I can unsubscribe at any time from the bottom of any email. I agree to this website’s Privacy Policy and Terms of Use.

While You Consider the Super Traffic Machine

Get the 17-part
"Yaghi Way of Traffic Generation"
Series Delivered to Your Inbox

Join our newsletter below and I'll send you a 4-page action plan to organically start, build, and grow an internet-based information-selling business by systematically answering questions. Plus the 17-part Yaghi Way of Traffic Generation mini-series.

Type your email below to start...

“By clicking ‘Read Tips’, I agree to receive daily emails from Jim Yaghi containing online marketing tips and advice. I accept these emails are written to help me sample and learn how YaghiLabs products & services can help me better advertise online. I also understand that I can unsubscribe at any time from the bottom of any email. I agree to this website’s Privacy Policy and Terms of Use.