i have some users in my db. The PHP script pick the users accurately, but redirect not working.

Please help any one my script is below:

if($sqlquery==1)
{
    $_SESSION['email']=$email;
    $_SESSION['password']=$password;
    wp_redirect( 'https://mcqpage.com/somepage', 301 );
    exit; 
} 
else
{
    header("location:http://www.mcqpage.com/index.php"); 
}  

Read more here: WordPress redirect issue with php


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: