PHP – Redirect to another web page

This post shows you how to redirect users to another web page using PHP. To do this, you simply use header function as shown right below.

index.php
<?php
$url = 'https://bytenota.com';
header("Location: $url");
exit;

The redirect URL can be a relative URL like this:

<?php
$url = 'contact.html';
header("Location: $url");
exit;
0 0 vote
Article Rating
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x