Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect to login page

I want to make login page, another php page handles the request, I want t check the validity of credential info, in a case that user name or pswd is not correct, I want to make redirection to login page, HOW can I make redirection in php ??

like image 860
palAlaa Avatar asked Dec 01 '25 14:12

palAlaa


2 Answers

Redirection in PHP is easy. Just make sure not to print out any HTML before you do it:

header('Location: http://www.example.com/');
like image 123
Blender Avatar answered Dec 03 '25 04:12

Blender


You want to use 'header()':

header('Location: /login.php');

Reminder that no data can be printed to the screen before a header() is called.

like image 31
RDL Avatar answered Dec 03 '25 02:12

RDL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!