What are the differences between absolute and relative URLs in the context of header redirection in PHP?
When using header redirection in PHP, it is important to understand the differences between absolute and relative URLs. Absolute URLs include the full path to the resource, starting with the protocol (http:// or https://), while relative URLs only specify the path relative to the current location. When using header redirection, it is recommended to use absolute URLs to ensure the correct redirection, especially when navigating between different domains or protocols.
// Using absolute URL for header redirection
header("Location: https://www.example.com/new_page.php");
exit();