Search Help

How can I redirect a user to another page?

You can redirect users to another page by manipulating the HTTP headers with the header() function.

For example, the following lines of code at the top of a file would redirect users to the Yahoo home page:

header("Location: http://yahoo.com");
exit();

Be sure to place your header function on the very first line of your script, before any other code. This function will not work if information has already been sent to your user's browser.

To learn more about PHP, we suggest consulting the PHP Group web site or other PHP resources.

Thank you! Your feedback has successfully been submitted.

Please tell us why you didn't find this helpful.

Send Feedback