nedjelja, 9. prosinca 2007.

redirect a visitor to http://www.example.com

Here's an example on how to redirect a visitor to http://www.newpage.com/

header('Location: http://www.newpage.com/');
?>


The above example shows how to redirect the visitor to a static address. You can also dynamically create the location to which the visitor is to be redirected.

$domain="http://www.google.com/search?q=";
$querystring="vinu%20thomas";
$redirectstr= $domain.$querystring;
header('Location:'. $redirectstr);
?>


The above code will create the URL for redirection as http://www.google.com/search?q=vinu%20thomas and then redirect them to the URL. You can also build php code which can conditionally redirect a page. See how this is done in the following example.

if($user==="Admin")
{
header('Location:admin.php');
}
else
{
header('Location:login.php');
}
?>

1 komentar:

anusuyaw3solutions kaže...

I have read this post. collection of post is a nice one ..that am doing website designing company chennai india and website development company chennai india. That I will inform about your post to my friends and all the best for your future posts..

 

Sopranos Ruby Css Xhtml Cgi Asp.net Calabria Rocky Oktoberfest Fencing