Remap function for CodeIgniter

I got tired of looking for this code in other projects so I wanted a handy place to keep it.

In case you’re wondering, this function is a reserved method in CodeIgniter controllers that will allow for a dynamic method name to be passed into the URL. Docs on it are here: codeigniter.com/user_guide/general/controllers.html#remapping.

2 Responses

  1. Allan

    Thanks man, this remap method save my life! 🙂
    really thanks!

  2. Michael Tracey

    Thanks, I was just looking for this. About to write it myself, and did one last google search, and boom.. you wrote it for me. Works like a champ.

    I will mention, in my case, I had to catch real 404’s in the function in the else statement and call show_404() if the input isn’t valid. (I’m using this to call a search if there’s no controller function for the exact URL).

    Appreciate it, keep up the good work.

Write a Comment