03
Feb
2011
2011
PHP code to redirect a page
You can set redirection of a page to any other url using a simple php code. In below code I will redirect to www.google.com
<?PHP
header("Location: http://www.google.com");
exit;
?>
If you want to set a timer with a message like “You will be redirected to www.google.com in 5 seconds” use below code.
<?PHP
header("Refresh: 5; url=http://www.google.com");
echo "You will be redirected to www.google.com in 5 seconds.";
?>
1 Comment to "PHP code to redirect a page"
Add Comments (+)-
Thanks for providing the basic redirection code. I somehow hate this coz i always go wrong with redirection problems. Guess the code might just help me overcome some of the issues.










