Not always showing 404_error custom page |
Hi,
I have been working with CI for just few weeks, and am still discovering and learning new things about it. Today I have faced an issue and although I have done some reasearch, I am not able to solve it. The thing is that I am running codeigniter (version 3) in localhost. And I am trying to customize the 404 error page. To do so, after following some tutorials out there, I did the following changes. First, I have created a CONTROLLER (Not_found.php): PHP Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); Then, I have generated the view, that can be found under: views/pages/404.php. To finish the job, I have modified the ROUTING adapting the file /config/routes.php as follows: PHP Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); Now, what happens is this. If I try to access an url that does not exist (for example: /localhost/this-does-not-exist), it shows the CI standard 404 error page. But, if I try to access any other random url containing a folder, then it works fine (for example: /localhost/folder/this-does-not-exist). Also, if I try to access urls under the content folder, they also show the CI standard 404 error page. So I guess that the problem is regarding the (:any) in the routes. But I am not able to find a solution to this while keeping both functionalities working together. What are your thoughts on this? Thank you so much! Regards
By the way, I forgot to share also the code inside the Pages.php controller (the Content.php controller is very similar):
PHP Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); |
Welcome Guest, Not a member yet? Register Sign In |