Jaydeepsinh Jadeja Jaydeepsinh Jadeja - 1 year ago 70
PHP Question

How to redirect a page in CodeIgniter?

I want to redirect a page if some condition returns true. I have no idea how to do this. Can any one provide me with an example?

Or is there any way to accomplish this?

Answer Source

Use the redirect() function from the URL Helper.

EDIT: load the url helper:

$this->load->helper('url');
if (condition == TRUE) {
   redirect('new_page');
}