Redirect in PHP

Using PHP redirection it possible to redirect a user to a different page.
In PHP we can use the header() function to send a new HTTP header, but this must be sent to the browser before any text.

Example

header(‘Location: ‘.$URL);

Note :

die() or exit()

header(“Location: http://example.com/mypage.php”);
die();

Other Redirection Option
<meta http-equiv=”Location” content=”http://example.com/”>

Or Using Javascript

window.location.replace(“http://example.com/”);

Leave a Reply

Your email address will not be published. Required fields are marked *