Controller not found except by route - 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: Controller not found except by route (/showthread.php?tid=37358) |
Controller not found except by route - El Forum - 01-06-2011 [eluser]sehummel[/eluser] OK, I admit it. I'm a CI newbie. I'm doing something really basic wrong and I've been at it for a couple of hours and can't find my error. I have a controller called login. It's in the resources folder in my controllers folder. It loads a view called login_form. But for the life of me it will not load if I go to domain.com/resources/login or domain.com/resources/index. But I can get to it via a route: Code: $route['engineering-resources/login'] = "resources/login"; Code: <?php The path is my resources folder in my controllers folder, and the controller is the login controller using the validate_credentials method. Here is the pertinent part of my login controller: Code: class Login extends Controller { The index function works when I use the route, but not when I use the above domain.com paths. I assume that is why it cannot find the validate_credentials method. What am I doing wrong? Controller not found except by route - El Forum - 01-06-2011 [eluser]sehummel[/eluser] I got my answer: I needed: Code: $route['engineering-resources/login/(\S*)'] = "resources/login/$1"; But what do the Code: (\S*) Code: $1 Controller not found except by route - El Forum - 01-06-2011 [eluser]Cristian Gilè[/eluser] Hi sehummel, Quote:I have a controller called login. It’s in the resources folder in my controllers folder. It loads a view called login_form. But for the life of me it will not load if I go to domain.com/resources/login or domain.com/resources/index.You go to to domain.com/resources/login without index.php. Do you use .htaccess? If not, it should be domain.com/index.php/resources/login. Quote:The index function works when I use the route, but not when I use the above domain.com paths. I assume that is why it cannot find the validate_credentials method. What am I doing wrong? Again, try domain.com/index.php/resources/login Quote:But what do the (\S*) is a regex matching non-whitespace character. $1 is the remapped variable from the route (what has been passed as (\S*)) Cristian Gilè |