Normally I would try do this with a mod_rewrite and the usual [R=302,L] and such. But I need to do this with PHP as my client would like a easier way of adding affiliate links herself, so I figured well she could just cut/paste a line of an array and change the # and url.
Example
Now that would work just fine and dandy... but she doesn't want the new link to show up in the address bar.
For example if I setup a rewrite rule so she can type http://www.somedomain.com/goto/3/
it would goto that php code above, then when it goes to the affiliates site
it should still say "http://www.somedomain.com/goto/3/ in the url
Anyone know the redirect code for that?
Example
Code:
$links = array();
$links[] = "http://www.ourownsite.com"; /* zero or blank, returns to own site */
$links[] = "http://www.somesiteone.com"; /* #1 */
$links[] = "http://www.somesitetwo.com"; /* #2 */
$links[] = "http://www.somesitethree.com"; /* #3 */
$links[] = "http://www.somesitefour.com"; /* #4 */
if(isset($_GET["l"])){ $lval = $_GET["l"]; } else { $lval = 0; }
if(isset($links[$lval])){ $linkout = $links[$lval]; } else { $linkout = $links[0]; }
header("HTTP/1.1 302 Moved Temporarily");
header("Location: $linkout");
exit();
For example if I setup a rewrite rule so she can type http://www.somedomain.com/goto/3/
it would goto that php code above, then when it goes to the affiliates site
it should still say "http://www.somedomain.com/goto/3/ in the url
Anyone know the redirect code for that?