How fix 404 error in CodeIgniter

Hey I’m new to codeigniter and I’m stuck in controller here the controller code please let me know what’s wrong with it! ?

class Pages extends CI_Controller	{


 	public function view($page ='about'){
 		if (!file_exists(APPPATH.'views/pages/'.$page.'php')) {

		$data['title'] = ucfirst($page);

here is the folder structure

What is it doing that it should not, or what is it not doing that it should?

Whenever I request for page “http://localhost:8080/Demo/pages/view” it should not executes ““show_404()”” because about page exist in this path views/pages

That image you show of your folder structure is showing it in controllers, is it in views/pages as well? You don’t show that bit of the folder structure.

@droopsnoot thank you for your quick response I caught the error

look the last piece of string which concatinate with $page (The extension the dot is missing with php) :sweat_smile:

BTW once again thanks alot for your response!

1 Like