I'm just learning CI, but I've encountered the following problem. I created a controller home.php with class home (the size of letters is the same). The controller loads the view home_view.
In config.php, I have the following parameters:
config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
routes.php:
$route['default_controller'] = 'home/index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
.htaccess file
DirectoryIndex home.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./home.php/$1 [L,QSA]
Where do I make a mistake?
It seems in your .htaccess file you redirect all callbacks to file home.php, instead of default CI's default index file, and this home.php does not exists (as you said it's a controller, and it should be in controllers folder)
htaccess should be like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
This way, is index.php file from codeigniter who loads all requierd files (config, routes, etc) and calls the controller specified in config.php file.
routes.php:
$route['404_override'] = 'my404';
Create a controller my404.php:
?php
class my404 extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view('error_404');//loading in my template
}
}
?>