Welcome Guest, Not a member yet? Register   Sign In
404_override controller cannot be in subfolder
#1

[eluser]sehummel[/eluser]
I spent three days banging my head against the wall trying to figure out why my 404 page would not load when there was no controller for that route. What it finally came down to was that for this route:

Code:
$route['404_override'] = "misc/route_map";
(folder/controller)

CI was reading misc as the controller name. When I moved route_map to the root controllers folder, everything worked right. You should be able to place a 404_override controller in a subfolder. This contradicts what is written in the routes.php file. The folder/controller mapping works perfectly in the rest of the site.

I am running version 2.1 of CI and have properly upgraded from 2.02.
#2

[eluser]CroNiX[/eluser]
So, I assume your index method is what you are actually using to handle the 404? I believe it is expecting a "controller/method" like everything else in CI. The example in config.php shows a controller/method.

Did you happen to try
Code:
$route['404_override'] = "misc/route_map/index";
? Maybe it will treat the first segment as a folder then if there are more than 2. Don't know, haven't tried...
#3

[eluser]sehummel[/eluser]
I tried that and it didn't work.
#4

[eluser]Matt S.[/eluser]
Looks like you can't have the override in a sub-folder. I just pulled this snippet out of CodeIgniter.php and it's hard coded to use the first segment as the class and second as the method:

Code:
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');




Theme © iAndrew 2016 - Forum software by © MyBB