_remap() function in codeigniter

In this tutorial I will explain in detail about _remap() function in codeIgniter. As we already know that the second segment of the codeigniter URI typically determines which method in the controller gets called. CodeIgniter allows you to override this through the use of the _remap() method.

Why _remap() ?

To hide the real method name in the URL you can use _remap() and you can define your own set of routing rules.

If your controller contains a method named _remap(), it will always get called regardless of what your URI contains.


If you URI is like as below:
Now if you want to change your method name only from the URI (without actual change in the controller method).


then you can use the _remap() in blog controller code to achieve this.

Any extra segments after the method name are passed into _remap() as an optional second parameter. This array can be used in combination with PHP’s call_user_func_array() to reproduce the CodeIgniter’s default behavior.


More about _remap() can be found in the codeigniter official website

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.