Skip to main content

How to Refresh Current Page in CodeIgniter?

With the help of CodeIgniter Built in function redirect(), we can refresh or redirect the page based on given parameters.

CI’s redirect() is resides in the URL helper, so in order to use redirect() function, you need to load url helper in the fallowing way.


$this->load->helper('url');
//or you can auto-load


redirect() function takes two parameters

The First Parameter is destination
The second parameter allows the developer to use different HTTP commands to perform the redirect “location” or “refresh”.
According to the Code Igniter documentation, “Location is faster, but on Windows servers it can sometimes be a problem.”
you can refresh current page in CodeIgniter with fallowing line of code :


redirect($this->uri->uri_string());


I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.