Need a new web host or having a problem with a script? Tips and advice on the best way to design, build and maintain your most valuable asset - your website!

Simple redirect script

PremiumMember
nick
Posts: 242
Joined: 17 May 06
Trust:

Simple redirect script

Having a link like this
"http://www.somesite.com/tracking/comission.php?id=123&u=184"
isn't to appealing, one think you can do is use a simple php redirect script.

lets say we had a site called - "http://www.mysite.com" and we had an affiliate link to someone else's site (affilorama maybe) , we can use this script to make the link a little easier on the surfers eye.

create a folder on your site like
"http://www.mysite.com/affilorama"

then in that folder create an index.php and include the following php code



save and upload that file - easy as that.
So for other sites we can replace that url with anything we want.
Make sure to save the page as a .php (not .htm or .html file).

Any questions just ask :)
  • 0
Last edited by sydney on 25 Mar 11 3:29 am, edited 2 times in total.
Reason: Fixed broken link
 

PremiumMember
splork
Posts: 35
Joined: 15 Jun 06
Trust:
Excellent. Thanks for the tip. I've been using a simple meta redirect and uploading that to each directory I build for that product. This looks pretty cool.
  • 0
Servicing the web sewers since 2006 http://lostballinhighweeds.com
 
PremiumMember
sean06
Posts: 1377
Joined: 16 Jun 06
Trust:
Ahh cool.

I always wondered how people managed to do that. :)
  • 0
www.SixDayWeekend.com
Free Training Videos reveal how I make 6 figures while travelling the world
 
PremiumMember
sean06
Posts: 1377
Joined: 16 Jun 06
Trust:
Ok, call me retarded, but I can't seem to get it to work.

I pasted the code with my link into index.php and put it in a new folder.

But when I load the new link, this is what I get:

Warning: Cannot modify header information - headers already sent by (output started at /home/productr/public_html/BurnTheFat/index.php:9) in /home/productr/public_html/BurnTheFat/index.php on line 11

I have no idea whats going on. It's bringing back bad memories of first year programming class :(
  • 0
www.SixDayWeekend.com
Free Training Videos reveal how I make 6 figures while travelling the world
 
PremiumMember
minitonas
Posts: 1
Joined: 14 Jun 06
Trust:
Hi,

Warning: Cannot modify header information - headers already sent by (output started at /home/productr/public_html/BurnTheFat/index.php:9) in /home/productr/public_html/BurnTheFat/index.php on line 11


Make sure you have removed all of the <html><body></body></html> tags etc. When you open the page in dreamweaver (or other), switch to 'code' view, and remove everything, then paste the redirect script. This should be all that is on the page. :D
  • 0
PremiumMember
nick
Posts: 242
Joined: 17 May 06
Trust:
Thats right, the script I posted should be the only text in that page =)
try and open it with notepad to see whats in there (who says notepad isn't the king of html/php editors!) hehe
  • 0
PremiumMember
sean06
Posts: 1377
Joined: 16 Jun 06
Trust:
Aha, I was putting the code in between the body tags.

Thanks.
  • 0
www.SixDayWeekend.com
Free Training Videos reveal how I make 6 figures while travelling the world
 
PremiumMember
drsolution
Posts: 1
Joined: 14 Jun 06
Trust:
Hi,
I am a newbie with this :? and
was wondering is this similar to what I have seen referred to as "Dynamic Affiliate Profit Linking"?

In addition, it seems that this can be used to shorten the link to something??
But using one's personal website???

I am not to keen on using a URL shrinker that uses a different website to store the info for all the links...

And of course, affiliate links being changed also is not nice... :(

Is it possible that the above script could be modified to do these things?

Thanks
DrT
  • 0
Sherwood
 
PremiumMember
kristine
Posts: 30
Joined: 20 Jun 06
Trust:
drsst wrote:Hi,
I am a newbie with this :? and
was wondering is this similar to what I have seen referred to as "Dynamic Affiliate Profit Linking"?

In addition, it seems that this can be used to shorten the link to something??
But using one's personal website???

I am not to keen on using a URL shrinker that uses a different website to store the info for all the links...

And of course, affiliate links being changed also is not nice... :(

Is it possible that the above script could be modified to do these things?

Thanks
DrT


Hi DrT!
Maybe I can help clarify things a bit. This redirect script essentially prevents people from chopping off your affiliate ID to prevent you from earning your commissions.

It's not really a "url" shrinker just more of a protection for you. Plus, since the page you have it located on would be on your server, you can better keep track of who has clicked on the link because obviously
they wouldn't get to the redirect page if they hadn't clicked on your affiliate link.

However, since it is PHP code your website should be hosted on a Linux machine (check with your hosting company). Otherwise the script won't work. (Unless M$ has implemented using PHP on their servers).

Heh - I've been using Linux for so long I don't know what M$ is doing!!! LOL!!!

Anyhow, hope that clarifies things.

If not, please reply and I'll do my best to help you as well.

Kristine
  • 0
clifftan
Posts: 25
Joined: 16 Jun 06
Trust:
How can I remove clickbank id "?hop" from the destination page after its been redirected? Is there anyway to remove it so that the user will not chop off my affiliate id in the URL.

Thanks!

rgds,
Clifford
  • 0
PremiumMember
kristine
Posts: 30
Joined: 20 Jun 06
Trust:
Nick wrote:



How can I remove clickbank id "?hop" from the destination page after its been redirected? Is there anyway to remove it so that the user will not chop off my affiliate id in the URL.

Thanks!

rgds,
Clifford


Hi Clifford!

Once you have redirected the page using the code that Nick provided above, it doesn't matter if someone chops of the ?hop... in your url. By this time the visitor is already at your affiliate site and the cookie has already been set on the visitors machine.

All the best,
Kristine
  • 0
Last edited by sydney on 25 Mar 11 3:31 am, edited 1 time in total.
Reason: broken link fixed
 

PremiumMember
vanandham
Posts: 2
Joined: 28 Jul 06
Trust:
Just in case anyone webhosts don't support php you can do the same thing using javascript. Just paste the following into any html document on any of your sites. then change the google url I have in there to whatever you need it to be.


Something else you might find handy is the setTimeout function which will delay whatever you are doing by the number of miliseconds you include... in this case 5000 or 5 seconds to everyone else. To use this just take the // coments out from infront (make sure you // coment out the other function 1st thou).

You may or may not want to use the delay function, at worst you can send something to your friends and direct them to your home page (or somewhere else....)!!!

8)
  • 0
antoniaj90
Posts: 2
Joined: 24 Nov 08
Trust:
I tried to use the PHP redirect and not sure if I got it proper. (broken link removed)

in my website, the page got redirected but I can actually see my affiliate link. Is there a way to just have it as the following:
example.com/recommends/rocketspanish
  • 0
Last edited by ampie g on 28 Jan 10 4:36 am, edited 1 time in total.
Reason: broken link removed
 

Site Admin
aletta
Posts: 3719
Joined: 09 Jul 06
Trust:
Antonia,

When do you see the affiliate link? Is it *after* you click through on your redirect link? Sometimes you'll see something on the end of a website address that looks kind of like an affiliate link, but isn't really. It might help if you show us the site you're talking about. (You can PM me if you like.) I'm pretty sure you don't own the "example.com" website ;)
  • 0
Are your changes not showing up on your website? Try doing a hard refresh! http://www.refreshyourcache.com/en/cache/
 
antoniaj90
Posts: 2
Joined: 24 Nov 08
Trust:
Thanks I finally got it. I was looking at it the wrong way.
  • 0