You are here: Re: php reidrects from one url to another « All PHP « IT news, forums, messages
Re: php reidrects from one url to another

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация