Just want to chat? Talk some smack. If it doesn't fit into one of the areas below then you'll be posting here (Note: Please try and find the best section before posting here)

How do I setup a PHP redirect?

promoter
Posts: 20
Joined: 17 Jun 09
Trust:

How do I setup a PHP redirect?

Hi Everyone,

I’m having a problem setting up my redirect based on what Mark wrote in the news letter:
Clickable affiliate links with redirects

Improve the clickability of your affiliate links with good-looking redirects

Date: Sunday, 6th September

The following is taken from the news letter:

HTML method (for use in WordPress sites or Xsite Pro) - While slightly more complicated, this is the preferred

option since it allows you to use a proper HTML Redirect and have more control over the redirect link created.

Use your FTP program to create a new folder (you can call this folder "recommends" if you like) on your site

(inside the public_html folder) and inside that folder create a new file named, for example, rocketspanish.php.

Edit that file directly from your FTP program using a program such as Notepad and paste the following code.

Make sure the code is inside PHP tags.

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: [http://www.youraffiliatelinkgoeshere.com]" );
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now, I've created a folder in my public folder:
1. called "recommends"

2. I created a notepad file and copied the code into it:
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: [http://www.youraffiliatelinkgoeshere.com]" );

3.I then replaced Header( "Location: [http://www.youraffiliatelinkgoeshere.com]" ); with my affiliate link.
Header( "Location: <a href="http://xxxxxxxx.hop.clickbank.net/?tid=ACNEIN3" target="_blank">click here</a> " );and save as.... a .php file and FTP'd it into the "recommends" folder.

But now I don't understand what Mark means by:"Make sure the code is inside PHP tags"????

What's the difference between saving it with the extention .php - .index - and .html?

If I'm split testing two products, would I create a folder within "recommends" for each product?
folder1
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: [http://www.youraffiliatelinkgoeshere.com]" );

folder 2
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: [http://www.youraffiliatelinkgoeshere.com]" );

or simply put them both into the "recommends" folder?

If I wanted to track the clicks on my links and I put google analytics code in the same notepad file but if I'm

already using google analytics on my site, will that create any negative issues on the site by having analytics on the site twice?

Thanks
Promoter
  • 0
jasondodd
Posts: 874
Joined: 08 Feb 09
Trust:
First of all when the newsletter talks about putting it inside PHP tags it means you start with <?PHP and end with ?>.

The file needs to be saved as a PHP file otherwise the redirect won't work (the PHP tells the web server it needs to process PHP code on the page)

For split testing I would recommend you setup two different hoplinks with different tracking IDs. You can keep the php files in the same folder, just use different file names. This would mean you wouldnt need to use analytics on those pages since Clickbank will be tracking the click-throughs.
  • 0
Limited time special - Try Affilorama Premium for just $1 for 7 days: http://www.affilorama.com/premium
 
promoter
Posts: 20
Joined: 17 Jun 09
Trust:
Hi Jason,
Thanks for your response. However, I'm none the wiser by your response?

In response to your reply below: yes, when I save the text file I will save it as a.php extention. However, I still don't understand what Mark means by "putting it between PHP tags??

First of all when the newsletter talks about putting it inside PHP tags it means you start with <?PHP and end with ?>.

The question I was trying to convey was what is the difference in functionality between saving the file as a

.php
.hmtl
.index

The file needs to be saved as a PHP file otherwise the redirect won't work (the PHP tells the web server it needs to process PHP code on the page)

Below is the script as copied from Mark's newsletter. It would be helpfull to clarify things for me if you pretend that this is your site and your affiliate link. What would it look like before you FTP'd it?

<a href="http://xxxxxxxx.hop.clickbank.net/?tid=ACNEIN3" target="_blank">click here</a> " );

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: [http://www.youraffiliatelinkgoeshere.com]" );


Thanks
  • 0
jasondodd
Posts: 874
Joined: 08 Feb 09
Trust:
Have you been through the redirect lesson on this site - it might help to make things a little clearer.
  • 0
Limited time special - Try Affilorama Premium for just $1 for 7 days: http://www.affilorama.com/premium
 
Site Admin
simonslade
Posts: 150
Joined: 13 Jun 06
Trust:
You can also use Affilorama's Free PHP Redirect Tool :)
  • 0
Add us on Facebook: https://www.facebook.com/affilorama
 
PremiumMember
gradyp
Posts: 1062
Joined: 28 Jun 09
Trust:
promoter wrote:The question I was trying to convey was what is the difference in functionality between saving the file as a

.php
.hmtl
.index

The file needs to be saved as a PHP file otherwise the redirect won't work (the PHP tells the web server it needs to process PHP code on the page)

Below is the script as copied from Mark's newsletter. It would be helpfull to clarify things for me if you pretend that this is your site and your affiliate link. What would it look like before you FTP'd it?

<a href="http://xxxxxxxx.hop.clickbank.net/?tid=ACNEIN3" target="_blank">click here</a> " );

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: [http://www.youraffiliatelinkgoeshere.com]" );


Thanks


Promoter,

As far as naming it a .php or a .html, a .php tells the web browser that the file is a PHP file, while the .html tells the browser that it is a HTML file. These two are treated differently. An HTML file is only a mark up file, while a PHP file will have some server side interaction.

As to what the file would look like, you'd put the <?php before the header lines and the ?> after the header lines. This is what tells the browser that this is treated as php code, rather than html code.

Also, if you use the generator, as suggested by Simon, it will generate the code for you. All you have to do is copy it, paste it into a notepad file, and save with a .php extension, and the file is ready for uploading.

Hope this helps some!

Grady
  • 0
Have questions about creating images? Want an image created for you? Check out my site at www.GradyPruitt.com/welcome-affilorama-friends
 
promoter
Posts: 20
Joined: 17 Jun 09
Trust:
Hi Guys,
Thanks for your input. I'm 90% of the way there now. What do I mean by that? As I've said before I'm split

testing two products now, I can get one to work but not the second one.

In my public folder I have .index.php file with my hop link, when I go to my site down in the bottom left

corner I see mysite.com/recommends/ so my link is masked so far so good and when I click the hyperlink it

takes me to the merchant's site,perfect.


Now, when I load the second .index.php file to my server it won't take it because it's seeing it as a duplicate

file,so I created a folder within my recommends folder and loaded the .index.php file into it.

When I go to my site I again see down in the bottom left corner mysite.com/recommends/newfolder,

everything seems to be working fine but when I click on the link instead of being taken to the merchant's

site,I get the following:

Index of /recommends/newfolder

* Parent Directory

Apache/2.2.12 (Unix) mod_ssl/2.2.12 OpenSSL/0.9.7i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4

FrontPage/5.0.2.2635 Server at mysite.com ????

If I add a prefix to the .index.php file it doesn't recognise it so that option doesn't work. So, this is where I'm

stuck now.

How do I resolve this?

Thanks
  • 0
Site Admin
markling
Posts: 2489
Joined: 13 Jun 06
Trust:
The idea behind using the index.php file for your redirect is that it means you can just use the folder name for the redirect e.g. mysite/recommends/affiloblueprint where affiloblueprint is the folder name, and inside that folder is just an index.php file with the redirection code. It has to be named index.php or it wont work - the web server looks for this file to load by default.

If youre split testing you'll need to create a new folder for the second redirection and include a new index.php file in there.

Hopefully that makes sense.

Mark
  • 0
Limited time special - Try Affilorama Premium for just $1 for 7 days: http://www.affilorama.com/premium
 
promoter
Posts: 20
Joined: 17 Jun 09
Trust:
Hi Mark,
In my public folder I have 2 folders:
1.recommends (which contains acnein3days .index.php file with my hop link)

2.acnenomore (which contains my .index.php file with my hop link)

Now, when I go to my site and hover over the link I see down in the bottom left corner:
mysite.com/recommends and when I click the link it takes me to the merchant's site. Everthing is working the
way it should.

When I go to the next link and hover over it, once again I see down in the bottom left corner my cloaked link:
mysite.com/recommends/acnenomore but when I click the link instead of being taken to the merchant's site I
get:

Index of /recommends/acnenomore

* Parent Directory

Apache/2.2.12 (Unix) mod_ssl/2.2.12 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4

FrontPage/5.0.2.2635 Server at [http://www.mysite.com]

What does this mean?

Promoter
  • 0
promoter
Posts: 20
Joined: 17 Jun 09
Trust:
Hi Mark,
I haven't received a response to my last post. affiliate-hangout/how-do-i-setup-a-php-redirect-t5030.html

Keith
  • 0
oneheadsup
Posts: 14
Joined: 22 Jul 09
Trust:
I'm new at this but am learning a great deal quickly. Without fully understanding the SEO ramifications I followed the instructions:

1) Set up a directory in my public_html folder (where I presently have 5 redirected websites in their own folders) and named it "recommends"
2) I created a notebook file and pasted in the code which Mark provided. I substituted the URL with my own ClickBank code as instructed. I enclosed the entire statement with <? and ?> (I looked up on Google what php tags were and found out about these, which seemed the simplest to use).
3) I renamed the txt file vendor1.php, it's icon changed, and I uploaded it into the recommends directory. I changed the links on my site which were originally set directly to my vendor1 to read: myprincipleURL.com/recommends/vendor1.php
When I clicked on this link, I arrived at the Vendor1 site as before, and saw my CB code on the address-bar as always.
4 )I created another php file as I did the first for the second vendor I am using, vendor2, and called that file vendor2.php, uploading it as well into the same recommends directory.
5) I changed all the links on my site for vendor2 to myprincipleURL.com/recommends/vendor2.php and they all worked perfectly as did the first.

My question is that since this all worked out so smoothly, what did I do wrong? Question 2, and perhaps more seriously, is how exactly is this diversion helping my SEO . . .what exactly is happening? I would really appreciate being able to understand this. Meanwhile, all my redirects from all my sites will have their own php files and will all be in this recommends folder, unless that is not something I should do?

Thanks.

Bruce
  • 0
Last edited by ampie g on 22 Jan 10 12:51 am, edited 1 time in total.
Reason: removed http as URL only used for illustration & not actual links
 

Bruce Fields & Trisha Crespo
http://oneheadsup.org
 
jasondodd
Posts: 874
Joined: 08 Feb 09
Trust:
promoter wrote:Hi Mark,
In my public folder I have 2 folders:
1.recommends (which contains acnein3days .index.php file with my hop link)

2.acnenomore (which contains my .index.php file with my hop link)

Now, when I go to my site and hover over the link I see down in the bottom left corner:
mysite.com/recommends and when I click the link it takes me to the merchant's site. Everthing is working the
way it should.

When I go to the next link and hover over it, once again I see down in the bottom left corner my cloaked link:
mysite.com/recommends/acnenomore but when I click the link instead of being taken to the merchant's site I
get:

Index of /recommends/acnenomore

* Parent Directory

Apache/2.2.12 (Unix) mod_ssl/2.2.12 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4

FrontPage/5.0.2.2635 Server at [http://www.mysite.com]

What does this mean?

Promoter


A few things you can try to fix your problem:

- copy the index.php file from the recommends folder into the acnenomore folder and try again
- try /recommends/acnenomore/ instead of /recommends/acnenomore (in case the server is getting confused with a file in the recommends folder and not redirecting to the folder)
- check the contents of the acnenomore folder to make sure theres nothing else in it
- copy the content of the index.php file that is working to the one that isnt

You have to check all your details carefully since this redirects are fussy - any mistake will cause it to fail.
  • 0
Limited time special - Try Affilorama Premium for just $1 for 7 days: http://www.affilorama.com/premium
 
jasondodd
Posts: 874
Joined: 08 Feb 09
Trust:
oneheadsup wrote:My question is that since this all worked out so smoothly, what did I do wrong? Question 2, and perhaps more seriously, is how exactly is this diversion helping my SEO . . .what exactly is happening? I would really appreciate being able to understand this. Meanwhile, all my redirects from all my sites will have their own php files and will all be in this recommends folder, unless that is not something I should do?

Thanks.

Bruce


Hi Bruce

To be honest I dont really understand your first question because it doesnt appear youve done anything wrong - its simply an alternative method. The important thing is you have the PHP redirect code in the file; the advantage of using the folder/index.php approach is you can create tidier URLs that dont need an extension e.g. mysite.com/go/fixme rather than mysite.com/go/fixme.php

Redirects dont have any positive impact on SEO - they are simply done to improve the clickabiity of your affiliate links, making them more likely to be clicked on people rather than getting put off by a big ugly affiliate link. It also means you can track the clicks using your own anaytics program.

Hope that helps

Jason
  • 0
Limited time special - Try Affilorama Premium for just $1 for 7 days: http://www.affilorama.com/premium
 
oneheadsup
Posts: 14
Joined: 22 Jul 09
Trust:
Thanks, Jason. Actually, my first question was meant to be humorous . . but I still wasn't sure I "achieved" what the intent of the redirect was, even though my slight variation seems to work fine. Reading Mark's earlier comment again I realized that using an index file within the recommends folder makes the link shorter and less "busy" looking, while allowing only one file for each folder (you would need "recommends2" etc. for additional redirects). My way of doing it allows me to place more than one redirect php file in one folder (recommends), but the name of the php file will be seen. I think that is still pretty simple looking and non threatening, but what do I know? If someone thinks I'm making an error, please let me know your experience.

Thanks.

Bruce
  • 0
Bruce Fields & Trisha Crespo
http://oneheadsup.org
 
promoter
Posts: 20
Joined: 17 Jun 09
Trust:
Hi Jason,
My head is spinning at this point. I've implemented everything you suggested. I've looked at the two affiliate links over and over and over..... until my eyes glazed over and I can't see any difference in the way the links are set up????

One link works 100% the other link works 99%?????

This makes no sense to me WHATSOEVER!

I don't know what else to do????

Is there anyone out there who has an answer for me?

Promoter
  • 0
promoter
Posts: 20
Joined: 17 Jun 09
Trust:
Hi Everyone,
Thanks for your input.
I've got the issue resolved. It turns out that there is a conflict between wordpress .htaccess file and the php redirect script.
Thanks
Promoter
  • 0
oneheadsup
Posts: 14
Joined: 22 Jul 09
Trust:
WordPress and the htaccess file is a continual source of problems, it seems. Glad you got it worked out.
  • 0
Bruce Fields & Trisha Crespo
http://oneheadsup.org
 
PremiumMember
cterao
Posts: 939
Joined: 18 Aug 09
Trust:
Hi Promoter (or anyone else that might know),

I seem to be having the same problem. Would you please tell me how you managed to work around it?

Thank You
  • 0
Clayton
I did AffiloBlueprint for one year - http://www.journeyofmyown.com/welcome-affilorama-friends/

Make $100 commissions by being my affiliate - http://exsolutionprogram.com/affiliates/
 
abrandan
Posts: 11
Joined: 23 Nov 09
Trust:
Hi Guys,
I'm with Promoter on this one. I use NVu . Now don't ask me how I did the first one and it works. All of the others don't and I can't open my stupid working PHP file to see what the heck I did right.

In NVu it won't save my php file unless it has all the other code in it like <head> or <body> tags. And if I save it this way as "all files" and give it a .php extension the sucker saves OK, and once loaded doesn't work.

This is really frustrating .... (look your video is great, and your generator is great, but it's the saving of the files in our website html editors that is the problem I think - and thus the hair-pulling grief part) I also tried it saving it in a text editor program with TextEdit (I'm a mac user) and it won't save it as a php file either.... suggestions please.

HELP!
  • 0
Angela B
 
gfs85
Posts: 1
Joined: 21 Jan 15
Trust:
Where is the redirect generator?
I checked the link in 'tools' mentioned above but don't find it there.
??
Just to be clear, I am understanding that if someone clicks on a link on an ad I have on Facebook or Amazon or YouTube, such as 'Smart Meals' it doesn't have a Clickbank or other affiliate code added, just a mySmartMeals.com link that sends them to my web site. On my website, i have a redirect that adds the affiliate code and sends it on it way. So, I have to buy the domain 'mySmartMeals.com' and have a website hosted for that domain. Then on that website, on a blank page, I have the forwarding information to the Clickbank website with my affiliate information, which I get from Clickbank, added to the url, which the clicker never sees. Is this close to correct????
  • 0

This topic was started on Sep 06, 2009 and has been closed due to inactivity. If you want to discuss this topic further, please create a new forum topic.