Thursday, February 21, 2008

Page redirection in php with header('Location...') : Blank page vs Working redirection

This kind of errors are what make debugging sometimes a very frustrating part of the developement, if you're suffering a blank page when trying to make a header('Location..'), give this a try:



This is a good redirection:

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

And this is a wrong redirection:


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


Notice a space between 'Location' and ':' this makes the redirection not to work!!!!

Simple errors likes this consume a lot of time :( , hope helps someone else...

No comments: