Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Redirects can be created in PHP using the header() function. This function sends a HTTP header to the client to redirect the user to a different page. The syntax of the function is as follows:

header('Location: http://www.example.com/newpage.php');

This code sends a header to the browser telling it to redirect to the specified URL. The browser then follows the redirect and loads the new page.

It is important to note that the header() function must be called before any HTML code is sent to the browser, or else an error will occur.