What are common pitfalls when using PHP for URL redirections?

Common pitfalls when using PHP for URL redirections include not using the correct header function, not exiting the script after the redirection, and not properly sanitizing user input to prevent security vulnerabilities. To solve these issues, always use the header function with the "Location" parameter to specify the URL to redirect to, use the "exit" function immediately after the header function to stop script execution, and sanitize any user input used in the redirection URL.

// Incorrect way to redirect
header("Location: newpage.php");

// Correct way to redirect
header("Location: newpage.php");
exit();