How can the HTTP Status Header be managed when using the header() function in PHP for redirection?
When using the `header()` function in PHP for redirection, the HTTP Status Header can be managed by including the appropriate status code along with the location header. This allows you to specify the status code for the redirection response, such as 301 for permanent redirection or 302 for temporary redirection.
// Specify the status code along with the location header for redirection
header("Location: http://example.com/newpage.php", true, 301);
exit();
Related Questions
- How can PHP handle undefined index errors when receiving variable assignments?
- What are some strategies for organizing language files in PHP to avoid redundancy and make translation management more efficient, especially for global text elements like buttons or common phrases?
- How can PHP scripts be debugged to ensure proper functioning and display of website content?