I have many controllers in my Codeigniter applications, for example: Registration, Profile, Main, etc.
Now I want to create a User controller.
what I want:
- if people access the URL: example.com/signup , I want to use the default route for " Register "
- if people access the URL: example.com/bobby.ariffin , I want to redirect this to " User " because the URL is not handled by any controller in my applications.
I created this in my config / routes.php:
$route['(:any)'] = "user";
but it redefines the entire route in my applications using " User ".
Is there a simple route for Codeigniter that does not override other controller routes?
Update ---
I have a simple regex for this problem: Daniel Erante Blog
$route['^(?!ezstore|ezsell|login).*'] = "home/$0β³;
where ezstore, ezsell and login is the name of the controller in your applications.
source share