Q:

how to redirect to another page in php

//PHP redirect
header("Location: https://www.codegrepper.com/my-redirect-page.php");
die();
15
< ?php header("Location: http://www.redirect.to.url.com/"); ?>
2
<?php
/*
	This will redirect  to facebook.com
*/
$url = "https://facebook.com.com";
header("Location: $url");  
exit;
?>
2
header("Location: http://example.com/redirect_page.php");
die(); //Force the script to quit, or you would raise an error...
2
header("Location: /");
exit();
1
<?php
  header("Location: (redirect url)");
?>
1
//Write this in the Controller when working on Laravel.

header('Location: http://www.example.com/');
exit;
1
<?php header("Location: http://www.redirect.to.url.com/"); ?>
0
<?php header("Location: anotherDirectory/anotherFile.php"); ?>
0

New to Communities?

Join the community