0

In CodeIgniter's routes file, it is possible to map URLs to controller methods like this:

$route['url/segment/(:num)'] = 'controller/methodasdf/$1';

It works great, but what I'd like to do is stop the user calling the end route directly (methodasdf). I've tried setting the methods to private and prefixing them with an underscore, but that just results in a 404 error.

1
  • I just give you an oop tip: private methods can only be called from inside the class. Also, mindprod.com/jgloss/privatescope.html Commented Oct 21, 2011 at 8:49

1 Answer 1

1

In the controller you can check if $this->uri->segment(1) == 'your_nice_segment' and if it's not you can show him an error

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.