Skip to content
PHP Logo

What resources or tutorials are available for learning about URL redirection in PHP?

URL redirection in PHP can be achieved using the header() function to send a raw HTTP header to the browser, which will redirect the user to a different page. This is commonly used for redirecting users after form submissions, to handle page not found errors, or to redirect users to a different page based on certain conditions.

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