{"id":374,"date":"2007-04-20T07:19:28","date_gmt":"2007-04-20T12:19:28","guid":{"rendered":"http:\/\/teamtutorials.com\/web-development-tutorials\/how-to-redirect-affiliate-links"},"modified":"2009-03-13T10:58:10","modified_gmt":"2009-03-13T14:58:10","slug":"how-to-redirect-affiliate-links","status":"publish","type":"post","link":"https:\/\/teamtutorials.com\/web-development-tutorials\/how-to-redirect-affiliate-links","title":{"rendered":"How To Redirect Affiliate Links"},"content":{"rendered":"
This tutorial will show you how to redirect your affiliate links using a PHP script and a simple edit to your .htaccess file. For some reason users seem to trust links more if the reside on your own server. Using a “link cloaking” technique is an easy way to increase revenue from affiliate offers. <\/p>\n
For this tutorial we will use the website www.scholarshiphunter.info for example. On the left navigation menu you will see an affiliate section. If you mouse over you will notice that the link goes to a folder on the site called links. Really, the folder \/links doesn\u2019t exists. We modify the .htaccess file to redirect the requests for the url \/links to a script called link.php. So for example:<\/p>\n http:\/\/www.scholarshiphunter.info\/link\/efinance-loans<\/p>\n actually redirects you to the real url:<\/p>\n http:\/\/www.scholarshiphunter.info\/link.php?id=efinance-loans<\/p>\n It may sound difficult, but it is really very simple. First create the PHP file that will redirect the links to the appropriate affiliate offers. You can do this in notepad if you don\u2019t have an editor of choice, however I will use Dreamweaver because I like the way it colors the code. Basically the only things that you need to change are the link variable and the affiliate link. The link variable is the \u201cfolder\u201d that you want the link to be sent to on your server. The affiliate id is the affiliate link provided by your affiliate company. The bottom section of code simply gets the id variable from the browsers and redirects you to the affiliate offer, using a header redirect.<\/p>\n Here is the exact PHP code used on scholarshiphunter.info: Create to file, replacing the variable and the afflaite links with your own, and save it as link.php. Upload this file to the root of your web directory on your server. Just remember that when you edit the file, do not include a comma on the last affiliate link offer.<\/p>\n
\n<\/a><\/p>\n
\n<\/a><\/p>\n
\n<\/a><\/p>\n
\n<\/a><\/p>\n