Download PDF

Easy PHP Redirect Code For Affiliate Links

 

It’s time to change the way you redirect your pages to affiliate links. Google does not like bare affiliate links and it looks like they also are not big fans of the 301 Redirect.

You can easily create a php redirect that looks like a normal page to the Almighty Google.

Have your affiliate link ready and follow the process below

  1.  Paste this code into a text file using notepad

<?php
/* Redirect browser */
header(“Location: http://YourAffilliateLinkHere.com/”);
/* Make sure that code below does not get executed when we redirect. */
exit;
?>

Next, in the code you pasted in notepad, Replace the http://YourAffilliateLinkHere.com with your actual affiliate link followed by a /

Save it to your desktop as “index.php”by selecting “All files” on the drop down menu, not .txt when saving. Be sure that you include the .php extension or it will not work.

php redirect for affiliate links

See the Image to the right for a graphic on How to save your .php file

 

Next, create a new folder in your domain root directory or if you use Hostgator You create a new folder with the keyword you are targeting in your public_html folder on your hosting account.

Upload the index.php file to that directory. In naming the directory use a keyword related to the product you are redirecting to.

Upload your “index.php” file into the folder you just created.

You now have a a nice, clean link to use in place of your affiliate link that looks like this: http://mysite.com/recommendedproduct.

 

 

That’s all there is to it.  So far, the search engines cannot read php, so it is a safer way to cloak your links.

I hope you found this easy php redirect tutorial useful. If so please Comment, Like and Share!

Something BIG is brewing at Empower Network! Get in now and be prepared for the upcoming Huge Promotion that will help people who have never made a dime online before earn residual monthly income!

Click Here To Lean About How NEO Network Is Changing Peoples Lives

 

Namaste!

meanddeb Maintaining Your Sanity With A Home Business

Timothy Langen
484-241-6497
SKYPE timlangen47

Look Me Up On Facebook:
http://www.facebook.com/empoweredsuccess

My short bio

Incoming search terms:

  • create directory in php code
  • php redirect script

Tagged with:

Filed under: MarketingSEOTutorials

Like this post? Subscribe to my RSS feed and get loads more!