If you’re like me and have jumped into affiliate marketing head on, you may not know some of the nuances of using affiliate links. Recently, James Seligman of JMCA Media schooled me on how to really easily set up PHP redirects for your affiliate links to make them a bit more user friendly. Let me share this knowledge with you!
- Open up Notepad or a similar text editing program.
- Add the following code:
<?
header(“location:affiliate-link-goes-here“);
?> - Replace the portion in italics above with the tracked link from the program of your choice.
- Save the file as a .php file with whatever name is easiest for you.
- Upload it to a designated diretory or folder on your website. Some possible names for the folder are recommends, deals, however you can call it whatever is easiest for you.
- When you want to add an affiliate link, just add the code <a href=”/recommends/affiliate.php”>Affiliate </a>
It’s that simple! I had head of PHP redirects before but, not knowing PHP very well myself, I never looked into how to do it. Luckily James was there to show me just how easy it is! And now you have a weekend project to go mask all your affiliate links!
5 Comments
Join the conversation and post a comment.
Trackbacks/Pingbacks
- Link Cloaking - Affiliate Programs Forums - [...] be the most common, and PHP is really easy to do. I wrote a blog post a long while…

Awesome! Glad this came right at the right time then 🙂
Thanks Trish. I was trying to use the php files, and I understood how to make them, but I did not understand where to put them or refer to them. This was very timely for me.
Hmm.. It doesnt work for me… It just opens up the http://www.mysite.com/recommends/affiliate.php i the url without redirecting….
Hmm… try removing the space between Location: and the link. So
header(”location:link“);
fantastic! thank you so much for sharing… I need to get on with these links sooner than later