How to redirect a page in PHP?

Use the header() function with the Location header to redirect to another page. Always call exit after it, so the rest of the script does not run.

<?php
header("Location: https://tutorialsclass.com/");
exit;
?>

For a permanent redirect, pass the status code as the third parameter.

<?php
header("Location: https://tutorialsclass.com/new-page/", true, 301);
exit;
?>
Note: The header() function must be called before any output (even a space or blank line). Otherwise PHP shows a “headers already sent” warning. See PHP header() function.

Learn more about the similar topics:
Tutorials
PHP Forms Handling
PHP Send Mail
PHP header() Function
PHP mail() Function
Exercises & Assignments
Create a PHP Form with 2 fields Name and Hobbies
Interview Questions & Answers
What are the form method Attribute available for submitting?
How can we submit a form without a submit button?
What is the difference between GET and POST method in PHP?
How to redirect a page in PHP?
How to get the browser details of a visitor in PHP?
How to get the previous page (referrer) URL in PHP?
How to get the IP address of a visitor in PHP?