Search Help:  
 
Enter keywords to 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 researching the PHP Group web site or getting a book on PHP. It may also be helpful to review other PHP resources.

Was this article helpful?

Yes   No
Click to contact Customer Care for further assistance.