CodeIgniter Forums
Route 404 Over Ride sub directory issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Route 404 Over Ride sub directory issue (/thread-63392.html)



Route 404 Over Ride sub directory issue - wolfgang1983 - 10-25-2015

Hello,

In codeingiter application/config/routes.php

I would like to know if possible to have sub directory / name

controllers > error > Not_found.php

PHP Code:
$route['404_override'] = 'error/not_found'

But it only seems to work with code below.

PHP Code:
$route['404_override'] = 'not_found'

I need it to be able to get from sub directory.

Is there any way to change it?


RE: Route 404 Over Ride sub directory issue - mwhitney - 10-26-2015

As mentioned in the user guide:
http://www.codeigniter.com/user_guide/general/routing.html#reserved-routes

Quote:Same per-directory rules as with ‘default_controller’ apply here as well.

So, the 404_override setting defines a controller/method pair only, just like the default_controller setting. An error directory containing a not_found controller would only be called if the $RTR->directory was already set to 'error' by the route it was attempting to resolve and 404_override was set to 'not_found'.


RE: Route 404 Over Ride sub directory issue - wolfgang1983 - 10-26-2015

(10-26-2015, 01:09 PM)mwhitney Wrote: As mentioned in the user guide:
http://www.codeigniter.com/user_guide/general/routing.html#reserved-routes


Quote:Same per-directory rules as with ‘default_controller’ apply here as well.

So, the 404_override setting defines a controller/method pair only, just like the default_controller setting. An error directory containing a not_found controller would only be called if the $RTR->directory was already set to 'error' by the route it was attempting to resolve and 404_override was set to 'not_found'.

I can understand not being able to use sub folder in default controller but should be able to have sub folder for 404 overrides.

I will not use override 404 then on routes I will find another way.