Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php redirect script for affiliate links

php redirect affiliate link

6:41 pm on Jul 2, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:May 21, 2004
posts: 385
votes: 5

Been doing some research on this lately and have decided the best way to handle my affiliate links is to create a php script which I can call and then redirect to the actual affiliate link. It was said the great Matt Cutts even recommended this.

So, few questions...

- Would it be correct to use something along the lines of www.mysite.com/script.php?id=product1 which then redirects to the actual url?

- Would I use rel=nofollow on the www.mysite.com/script.php?id=product1 in my pages?

- in robots.txt would I also exclude script.php even with the nofollow or just exclude it without the nofollow?

Going a step further into the thought process what kind of security steps should be taken so the script cannot be manipulated? Simple thinking tells me if I use id=whatever that the script could not be manipulated as anything value that does not exist I could just send to the index page or something - correct?

Anyone care to share a good example I can run with or flat out use?

Tedster... you seem to be on most of the posts regarding the affiliate redirects I read... please chime in if you have the time.

Thanks everyone!
7:26 pm on July 5, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:May 21, 2004
posts: 385
votes: 5

1:57 pm on July 7, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 30, 2007
votes: 0

Some thoughts about your questions:

1. Yes with the script.php handling the redirect
2. No need to, instead use js hooking the click handler with a unique identifier perhaps to avoid automatic submissions.
3. You won't have to if you use js because there would be no visible/hard link.
8:46 pm on July 7, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:May 21, 2004
posts: 385
votes: 5

Thanks for the reply, but I want to stay away from using js and only use php.

I'm still doing research on this and the one question that stands out to me is this :

www.mysite.com/script.php?id=product1 ... this seems as though, Google for example, might see this as cloaking as I am showing the above link, however, directing the user to another (affiliate link)... thoughts on this? As a webmaster I can see many reasons why the above would be beneficial to me (easily change sitewide links on one page, etc, etc), however, does Google see it that way? Some would say the fact I am questioning it means I should be leary of it.

I also have seen sites which use the same format above, however, their id value in this case IS the url they want to redirect to... in other words they are not hiding anything (which Google likes)...


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members