Skip to content

Instantly share code, notes, and snippets.

@duellsy
Created February 17, 2011 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duellsy/830760 to your computer and use it in GitHub Desktop.
Save duellsy/830760 to your computer and use it in GitHub Desktop.
Send user to 404 page if controller exists but method does not (add to MY_Controller.php)
function _remap($method) {
if (in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) {
$uri = $this->uri->segment_array();
unset($uri[1]);
unset($uri[2]);
call_user_func_array(array($this, $method), $uri);
}
else {
redirect('404');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment