Hello,
I’ve created and uploaded my website and database into the server.
If I tried to login in my website, it does accept the credentials if they’re right or wrong but it doesn’t redirect to my homepage.
I tried every redirect that I have e.g Forgot Password or Register.
Summary of problem: header redirection doesn’t work.
Hi Supun,
Thank you for the tip & apologize for the late reply as I was out of office for the past 3 hours.
If possible kindly help me on it as I got the header error after I added the codes to .htaccess
Error Caught: Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd4/074/3649074/public_html/Project/Project/PHP/Login.php:1) in /storage/ssd4/074/3649074/public_html/Project/Project/PHP/Login.php on line 41
Header information such as Content-type, Content-length, Location are sent when you first echo out the output. You can’t send a header after that. Simple trick is above shown. Apache server keeps the output queued until all the process is finished and sends all with headers at the last moment
If you think this will slow down your process, you can consider following. (Can’t do this after echoing some output. If so, you have upper given solution.)
Add header() functions at the top of the script (after session start)