rodrico101 Posted August 14, 2008 Share Posted August 14, 2008 Hi, I am looking to write a script that redirects my affiliate links to their appropriate sites. I want to have this as my clickable link: www.mysite.com/recommends/ebay.com I prefer not to have "id" in my redirect and want the link in the above form. Have a good idea how to start, but am coming up short. Any help would be greatly appreciated. Rod Link to comment https://forums.phpfreaks.com/topic/119740-php-affiliate-redirect-script/ Share on other sites More sharing options...
BioBob Posted August 14, 2008 Share Posted August 14, 2008 Use output buffering and headers. ob_start(); if (strpos($url,"mysite.com/taco)) { header("Location: http://redirected_absolute_url"); } else if (strpos($url,"mysite.com/hamburger)) { header("Location: http://other_site"); } else if(strpos($url,"mysite.com/whatever)) { header("Location: http://where_ever"); } $ob_contents = ob_get_contents(); ob_end_clean() echo $ob_contents; Although in this example you dont really need output buffering cuz Im not defining any variables, I have a feeling you'll have use for it in the future. Could also use a meta-refresh html tag also... Link to comment https://forums.phpfreaks.com/topic/119740-php-affiliate-redirect-script/#findComment-616950 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.