Redirection in PHP

The header function in PHP can be used to redirect the user from one page to another. It is an in-built function that sends raw HTTP header to the destination (client).

Syntax of header function

header( $header_value, $replace_value, $http_response_code)

Following are the parameters −

  • The ‘header_value’ in the function is used to store the header string.
  • The ‘replace_value’ parameter stores the value that needs to be replaced.
  • The ‘response_code’ is used to store the HTTP response code.



The website to which the page needs to be redirected is specified in the header function.

Updated on: 01-Jul-2020

6K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started