• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom routing, if not controller, do following

I was wondering if there is a way to do something with routing so that if the string where the controller is isn't a controller it does one thing and if it is a controller then it performs normally. I'm pursuing a regex route, but I didn't want to have to hard code all of my controllers in it ...

There is a new route in CodeIgniter 2: $route['404_override'] = 'controller/method';

Where 'controller/method' is the one that will be called in case the requested controller doesn't exist.

Hope it helps!

Interesting, I'm still on 1.7.2 but that's cool to know about. I ended up doing something like this:

$route['^(?!discover|blog|support|photos).*'] = "photos/show/$0";

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.