How To Mask Your Ugly Affiliate Links Using Your Own Domain

by Tyronne

13 Flares 13 Flares ×

php affiliate redirect script

Affiliate links can look ugly and complicated at the same time. So having an easy way to mask those affiliate links and make them look professional can increase your chances of making sales. This short tutorial will help you create clean and professional looking links so you get more people clicking on them which will mean more money for you!

We are going to create what we call an “affiliate redirect script in PHP”. So lets get started.
First of all,lets take a look at an ugly affiliate link. In this example I’ll use the affiliate link I got from Hostgator when I became an affiliate, check it out below:

You’ll notice that the URL above is too complex. It would be hard to tell your prospect to go to this link in an audio and there is no way your prospect is going to remember it, its not catchy. So rather than give out this complicated url, share with them a more professional and clean looking one like this:

Nice and tidy eh? Well you can create affiliate links like this on your own domain if you have the requirements below

-Here are your requirements:
-Your own domain name
-A hosting account for that domain
-FTP access to your server so you can upload files (if you have Hostgator you can login into cpanel to upload files)
-A text editor like Notepad
-At least one affiliate link

1. Open up Notepad (any text editor will do) and copy the following PHP script to a new file:

<?php header(‘Location:’); ?>

2. Replace the example URL above with your own affiliate URL and don’t forget the quotes.

3. Save the file to your desktop and name it ‘index.php’ (without quotes).

4. Open up your FTP client (Filezilla is my favorite).

5. Connect to your servers home directory. Its usually at /public_html

6. Create a new directory on your domain called ‘recommends’

7. Go to the ‘recommends’ directory

8. Create a new directory called ‘hostgator’ or whatever you want to refer to your affiliate program as. It doesn’t matter what word you use, as long as its unique. I’m just using ‘hostgator’ for the sake of this tutorial.

9. Go to the ‘hostgator’ directory you just created

10. Once inside, upload that index.php file you had on your desktop to the open directory. This copies the file index.php to:

You’re finished!

Then just test the link by going to

Obviously if you used different directories, you would need to place my example url with the path you used

You can create all of your affiliates links this way. Just create new directories inside your ‘recommends’ directory and upload ‘index.php’ files to them.

The file ‘index.php’ is the default file accessed when someone goes to the directory you specify.

This is kind of the “geeky” way to mask your affiliate links but its better than sharing an affiliate link that looks ugly and unprofessional. Lately I’ve been using a wordpress plugin called Ninja Affiliate, it does the same thing but a whole lot more. Ninja Affiliate will track your clicks and keep all of your affiliate links organized and in one place. It also has a few other nifty features as well. You can check it out right here.

If you found this post useful don’t forget to share it with your following on Facebook,Twitter, or Google+


To Your Continued Success,

Tyronne Ratcliff





P.S. If you’ve had it with the “grind” and want a simple, step
by step formula that can have you generating your own leads
in 24 to 48 hours,click here to check out the system I use.




















{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: