Tag Archives: codeigniter redirect function not working

Codeigniter redirect


Codeigniter redirect – Redirect function is used to redeirect from one controller to another controller or (“header redirect”) to the specified URI.


Codeigniter redirect | To Another Controller | Page | URl Syntax

Note : $this->load->helper(‘url’); should be loaded before redirect.


redirect("location","refresh");

Where the First option is location ie. URI and second option is optional.
If you want to redirect refresh use the second parameter.

Codeigniter redirect Example

Here is simple redirect to the controller-


redirect("/post/66");

Redirect with Parameters

If you want to redirect with parameters you can pass parameters simply as below

redirect('TestController/Login/'.$user_email);

Codeigniter redirect not working

If codeigniter redirect is not working then make sure you have loaded the url helper properly.