How can PHP headers be used for page redirection?

To redirect a user to a different page in PHP, you can use the header() function with the Location parameter set to the desired URL. This sends a raw HTTP header to the browser, instructing it to redirect to the specified location. Make sure to call header() before any output is sent to the browser to avoid any errors.

<?php
// Redirect to a different page
header("Location: https://www.example.com");
exit();
?>