Reputation: 163
How does Facebook, for instance, "redirect" the user when logging into the site? For example, when you initially log in, you are on www.facebook.com, then the URL quickly changes to www.facebook.com/login.php, and then, assuming you submitted valid email/password, you are redirected back to www.facebook.com with your news feed, etc. Also to note, if your email/password are invalid, you are redirected to www.facebook.com/login.php and then stopped there and asked to retry your login. Are they using page redirects to achieve this? and if so, are they doing this in PHP...I would assume. Or are they using .htaccess? or another completely different method that I'm unaware of?
Thanks for your answers!
Upvotes: 0
Views: 133
Reputation: 884
They are using the php header function depending either on an if else command or switch class.
http://php.net/manual/en/function.header.php
As far as the pages /user that is an apache mod rewrite rule from a php page query
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
Upvotes: 0
Reputation: 9426
login.php validates the user info, sets cookies, then redirects. If Facebook really does use PHP, it would be
header("Location: http://facebook.com/");
die();
Upvotes: 1