|
Posted by Rik on 05/22/06 20:24
Nospam wrote:
> I have a series of links on my site, and I want them once clicked to
> be redirected to another site, I have heard that I could have a
> redirection.php file and in it have my link1, link2, link3 etc
> redirecting to different sites.
>
> Does anyone have an implementation example of the above
> redirection.php, or an amended example?
If you want them redirected to different sites, think carefully what your
exact reason is. Often it's just plain better to give the link to the actual
url.
Then again, if not, for example:
<a href="./redirected.php?link=2">Link 2</a>
redirected.php:
<?php
$urls = array(1=>'http://example.com', 2 => 'http://www.php.net');
header("Location: {$urls[$_GET['link']]}");
?>
Make sure you don't output ANYTHING to the client before a header(), not
even a blank line.
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|