What are some common methods for handling URL redirection in PHP?

Handling URL redirection in PHP is a common task when you need to redirect users from one URL to another. This can be useful for redirecting users after a form submission, handling page not found errors, or implementing URL shortening services. One common method for handling URL redirection in PHP is to use the header() function to send a Location header to the browser, which will instruct it to redirect to the specified URL.

// Redirect to a new URL
header("Location: http://www.example.com/newpage.php");
exit;