Are there best practices for implementing PHP redirection scripts to ensure a seamless user experience?

When implementing PHP redirection scripts, it is important to ensure a seamless user experience by following best practices. This includes using header() function to perform the redirection, setting the appropriate HTTP status code, and providing a clear message or explanation for the redirection.

<?php
// Redirect to a new page with a 301 status code
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com/new-page.php");
exit();
?>