Using A PHP Redirect

php redirect picture

PHP is a scripting language that is very common in web development. PHP originally meant Personal Home Page, but soon changed to – their is no way I will bore you anymore with this stuff! All you need to know is that we can use PHP to redirect our article links to affiliate products;)

What’s A Redirect?.

You walk up to your favorite store to try and enter, but notice the sign on the door telling you that they moved down the street, so that’s where you head toward.

A PHP redirect for websites work the same, you may lead people to your site via a link, but when you insert some simple PHP code, once they get to your site they are immediately sent to another website, your affiliate products website.

Why Do I Need To Redirect?

Some article directories I’ve been using will not allow you to link directly to your affiliate sales page, so I thought it might be a good idea to share with you the method I use that allows me to link to an affiliate product, and does not take hours or lines of code to pull off.

This is what EzineArticles require…

EzineArticles.com Editorial Guidelines: (AFFILIATE PROGRAMS):

Affiliate links will be allowed if the link is a domain name you own which forward/redirects to the affiliate link from the top-level of the domain name. For example, it is permissible to forward to an affiliate link from:

http://your-company-name.com/

…but it would not be permissible to forward to an affiliate link from:

http://your-company-name.com/page.html

http://your-company-name.com/subdirectory/

http://your-company-name.com/subdirectory/page.html

http://sub-domain.your-company-name.com/

Any article with an affiliate link that does not adhere to this guideline will cause the article to be rejected.

Also ArticlesBase will not allow direct affiliate links within articles posted on their site, how rude! GoArticles on the other hand does;)

How Do I Redirect?

Let’s get started.

I have a site that I use all my redirects on, this is an example of my redirection process. This would be my site….

www.redirectmephplease.com

Now if I sent someone to that site via a link as it is now, they would just end up at the site above and nothing would happen. But if I add some PHP code into the index file of that site with my affiliate link included, as soon as the visitor hit the site above they would then be redirected to my affiliate page.

Here is the code…

<?php
header(“Location: http://www.myaffiliateproduct.com/myaffiliatetrackingcode”);
?>

Just three lines of code!

If you understand what and where your index.html file is, then all you need to do is add that code above (with your own affiliate link included) into your index.html file BUT……… rather than save that file as a .html file, you need to now change it to .php -> index.php and not index.html and save it.

To make it even easier for you…

<?php
header(“Location: PASTE YOUR CLICKBANK LINK HERE STARTING WITH THE HTTP:// “);
?>

Just paste in your Clickbank affiliate link into the section in bold above removing everything from PASTE, right up to, but not including the “); <- leave that part where it is.

So you should now have a file called index.php with only the three lines of code above in it.

But Can I Only Use One Redirect Per Article Or Website?

Well yes and no. Using EzineArticles you are only allowed just one redirect, and it must come from your main top-level domain, which would be…

www.redirectmephplease.com

But because we added that index.php PHP redirect code above, this would now divert people to your affiliate link which is what we want, but then if you decide to write another article using Ezine, then you have to add that PHP index.php redirect file to anther one of your domains using the same process!!

However if you use ArticlesBase you can use more than one redirect per domain. I hear you saying “Yes, but we just used our index file to send people somewhere else, how can we use another?” My method here is to add a new folder to my site.

Like this example…

www.redirectmephplease.com/articletwo/

So I added the folder articletwo and uploaded it into my public_html directory for that domain. Remember to use a new folder, and not just a file. Using a folder means we can again use our redirect index.php file but this time with a different affiliate link included.

Like this….

www.redirectmephplease.com/articletwo/index.php

You can do this time and time again making sure every time you write a new article, you add a new folder and a new index.php file.

Tip Time – I always name my new folders using my main keyword that I’m targeting for that article, so if I was writing an article that targets the keyword-> fuzzy ferrets <- then the folder and redirect link I would create would look like…

www.redirectmephplease.com/fuzzyferrets/index.php

I do this for SEO purposes myself, but you can name your folders whatever you want, even fuzzy ferrets;)

Where Do I Paste My PHP Redirected URL?

Now you have it saved on your domain always check to make sure it works by redirecting you over to your affiliate page, if it works then you can get started adding this link into your articles.

Some article directories only allow you to post just one link in your author bio at the end of your article, but others will let you post it where you want, whatever one you use just make sure you read the guidelines so that your article does not get rejected.

Another thing to take notice of is that if you can use keyword links in your article rather than just pasting the entire link in like this..

http://www.redirectmephplease.com/fuzzyferrets/index.php

Instead you might be allowed to use a <a href> like this…

<a href=”http://www.redirectmephplease.com/fuzzyferrets/index.php”>Fuzzy Ferrets</a>

I colored the link that people will see if you can use a <a href> in blue, because that is what they will only be able to see from that code above, which is also great for SEO by being able to use you main keyword in the link text.

Hopefully that cleared up using a PHP redirect to link to your own affiliate products in articles, the good thing about this php method is that it’s very simple to repeat many times over. However if you have questions or get stuck please let me know below and I’ll do my very best to help you through it.

Tags: , , ,


    Warning: Invalid argument supplied for foreach() in /home/elliotw/public_html/wp-content/themes/kepple-08/comments.php on line 65
 
close Reblog this comment
blog comments powered by Disqus