Skip to content
PHP Logo

How can PHP headers be used to redirect to a specific HTML page?

To redirect to a specific HTML page using PHP headers, you can use the "Location" header with the URL of the page you want to redirect to. This sends an HTTP header to the browser, instructing it to redirect to the specified page.

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