I want to redirect someone to index.php, how do i do this? But not the “meta” method, because it needs to be in header, and i can not have it there.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do not use JavaScript for this. If the user has JavaScript disabled (or most likely is browsing with a browser without support for JavaScript), the redirection will not work.
From your PHP code, you can send an HTTP header to direct your user to the page of your choice. Use the
header()function to do this.If PHP complains that it cannot send the header because data has already been sent to the browser, simply go to the top of your script and enable output buffering by using
ob_start():With output buffering enabled, you can send headers anywhere in your code since data is only sent at the end of your script.