Is it possible to setup CI such that when a URI match is made it follows the standard method of calling the method of the matched class, but when no class is matched, it calls the default class instead?
For instance, lets say I have the following controllers defined:
controllers/main.php
controllers/page1.php
When the URI is
localhost/Main
thencontrollers/main.php
class matches (standard CI)When the URI is
localhost/
then thecontrollers/main.php
class matches (assuming default controller is defined inconfig/routes.php
)When the URI is
localhost/Page1
then thecontrollers/page1.php
class matches (standard CI)- When the URI is
localhost/Undefinedpage
then I want the
controllers/main.php to be matched.
Note I can't list this explicitly in the config/routes
because I
don't know what the actual text is.
I also don't want to do wild-card match because it would prevent the normal operation of CI. I also don't want to setup a route for each controller - that would be silly.
A 404 over-ride is close to the operation I want, but the 404-override doesn't prevent a 404 from being issued - so that solution is not valid either.
Thanks for your suggestions.