How to redirect a page in PHP?

Last updated 5 years ago | 1341 views 75     5

Tags:- PHP

PHP | Redirect

PHP header() function is used to redirect a page to another page. It supplies raw HTTP headers to the browser and redirects it to another location. The redirection script should be at the very top of the page to prevent any other part of the page from loading. The target is specified by the Location: header as the argument to the header() function. After calling this function the exit() function can be used to halt parsing of the rest of the code.

header(location: www.studyzone4u.com); // This will redirect to www.studyzone4u.com.