404 Override Not Working |
I this controller Notfound.php
Path: application > controllers > Notfound.php I place it in the override 404 in routes PHP Code: $route['404_override'] = 'notfound'; But still does not show not overriding the 404. I use virtual hosting with xampp This is my htaccess PHP Code: Options +FollowSymLinks I am not sure why it is not overriding it anysuggestions? My template library is autoloaded PHP Code: <?php
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
I've noticed this sometimes too, in some circumstances it won't override to your specified controller.
Can you provide us with the code which should be triggering the 404 that you expect to be overridden, and if you edit the views/errors/html/error_404.php do you see the changes you make appear on the 404 page you're seeing?
(06-20-2017, 01:32 AM)reactionstudio Wrote: I've noticed this sometimes too, in some circumstances it won't override to your specified controller. Just attached it. To the main OP
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
when the 404 is triggered do you not see the default / stock codeigniter 404 page or does your notfound controller fail to load? What output are you seeing instead of the 404 page you're expecting?
(06-20-2017, 01:49 AM)reactionstudio Wrote: when the 404 is triggered do you not see the default / stock codeigniter 404 page or does your notfound controller fail to load? What output are you seeing instead of the 404 page you're expecting? Yes the normal default 404 shows but not my override one.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Viewing the Core code, setting a custom 404_override in ./config/routes.php does not change how the show_404() method is used.
The override is used for when your Controller can not be located. It will then load the Controller that is set in the config value. This is not what is happening in your case, because CI can locate the controller. Look at the docs https://codeigniter.com/user_guide/gener...l#show_404 What you need todo is create your own show_404 method or redirect to your custom Notfound controller instead of calling show_404 and pass along any needed arguments
(06-20-2017, 01:52 AM)reactionstudio Wrote: also, if you navigate to your notfound controller manually what do you see? I see the not found page when I navigate to it just the override not working
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
(06-20-2017, 02:00 AM)Martin7483 Wrote: Viewing the Core code, setting a custom 404_override in ./config/routes.php does not change how the show_404() method is used. Thanks for that will look into it.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
If you create the file: application/core/MY_Exceptions.php with the following code what happens?
PHP Code: <?php dont forget to replace www.yoursite.com with your applications domain. If it works you'll need to change how the base_url is passed in but this should be enough to see if it makes progress towards a solution. |
Welcome Guest, Not a member yet? Register Sign In |