Routing errors page |
Hello,
First to say : I am new to CI. I want to make a single page for errors 404, 403, ... I created a controller and a view to use this way: http://localhost/error/404 When I enter this adress, the page is displayed correctly. routes.php contains : PHP Code: $route['404_override'] = 'error/show/404'; Then I try to input a wrong address, I have the error : Message: call_user_func_array() expects parameter 1 to be a valid callback, class 'Error' does not have a method 'show/404' I tried to del 'show' in url but same case. Hope someone can point me where I am wrong. JP Error.php (index should be unused) PHP Code: <?php
404_override is rather a configuration setting, not a route. It doesn't translate URI parameters.
(02-13-2016, 08:55 AM)Narf Wrote: 404_override is rather a configuration setting, not a route. It doesn't translate URI parameters. OK thanks. So I managed that in another way. Error.php : PHP Code: <?php in routes.php : $route['404_override'] = 'error'; $route['error/(:num)'] = "error/index/$1"; In .htaccess: ErrorDocument 403 /error/403 This way I may redirect to an error page when I need and leave CI and apache deal with standard errors. JP |
Welcome Guest, Not a member yet? Register Sign In |