Codeigniter Remap Function

Codeigniter Remap Function : Codeigniter Remap Function is used to override the default function called in url.

For example : where Home is controller and user is method(function) name.

You can override the function name “profile” with other function name in the controller.
Means you can map original function name with your custom name in url.

Codeigniter Remap Function Example

For example if want to map url

defined('BASEPATH') OR exit('No direct script access allowed');

class User extends CI_Controller {
public function _remap($method){
  switch ($method) {
     case 'about' : 
      $this->about_me();// call about_me() function.
     case 'edu' : 
      $this->education();// call education() function.
     default :


public function index(){

echo "Welcome to index function."; 


public function profile(){
 echo "Welcome to profile function";
public function about_me(){
 echo "Hi I am John !";
public function education(){
 echo " I am Master in Computer application.";


1. Example :

Map http://localhost/User/about to the http://localhost/User/about_me

Hit the url


Where about calls about_me() function.


Try it »

2. Example :

Map http://localhost/User/edu to the http://localhost/User/education

Hit the url


Where edu calls education() function.


Try it »

Add Comment

📖 Read More