Custom routing, if not controller, do following - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Custom routing, if not controller, do following (/showthread.php?tid=33246) |
Custom routing, if not controller, do following - El Forum - 08-19-2010 [eluser]msteudel[/eluser] 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 ... Custom routing, if not controller, do following - El Forum - 08-20-2010 [eluser]gyo[/eluser] 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! Custom routing, if not controller, do following - El Forum - 08-20-2010 [eluser]msteudel[/eluser] 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"; |