Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter "The page you requested was not found." error?

I'm having a problem with CodeIgniter. I've checked every possible solution on the internet and seems like nothing helps in my case. I'm not a big pro and it's my first time using CodeIgniter so don't be harsh with me.

routes.php:

$route['default_controller'] = "page";
$route['404_override'] = '';

$route['(:num)'] = "page/index/$1";

page.php:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Page extends CI_Controller {

    public function index($id=null) {

        $this->load->model('Image','',TRUE);
        $this->load->model('Banner','',TRUE);
        $image = $this->Image->getImageById($id);
        if (empty($image)) {
            show_404();
        }
        //db table `banner` always have three rows
        $banners=$this->Banner->getBanners();
        $data=array();
        $data['image']=$image;
        $data['banner']=$banners;
        $this->load->view('page_index', $data);
    }
}
like image 315
Ricardo Avatar asked Sep 15 '25 10:09

Ricardo


1 Answers

I have read your problem. You have done mistake while saving the controller.

It should be saved in capital i.e. Page.php but you have saved as page.php

I think this will work out !

like image 137
isarojdahal Avatar answered Sep 18 '25 10:09

isarojdahal