Redirect Web Page to Another Web Page: PHP Redirect Script

How to redirect from one page to another ? It is a common question from beginner developers in PHP. You can easily transferred to the new page without having to click a link to continue by using a default power of PHP which is also useful for search engines.,

Stop Execution

It is very important to stop the script after sending header command. “exit” will ensure to stop the execution of next code or algorithm before the completion of header command.

/*
|-----------------
| Stop Execution
|------------------
*/
exit;

Very Important

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.