In this tutorial we will learn about CodeIgniter Page Redirection. When web applications are built, we often have to redirect the user from one page to another. CodeIgniter facilitates this work for us. For this purpose, the redirect () function is used.

Syntax redirect($uri = ”, $method = ‘auto’, $code = NULL)
  • $uri (string) ? URI string
  • $method (string) ? Redirect methods (‘auto’, ‘location’ or ‘refresh’)
  • $code (string) ? HTTP Response code (usually 302 or 303)
Return type void

The first argument may contain two URI types. We can pass the full URL or URI segments of the site to the controller you want.

The second optional parameter can have either the three auto, location, or refresh values. The default is automatic.

The third optional parameter is only available with redirect location and allows you to send specific HTTP response codes.