Balakumar B Balakumar B - 4 months ago 12
PHP Question

404 page not found error in Codeigniter

I am new to the codeigniter framework and I have tried to make my first program but received a

404 page not found
error

This is my root directory
Codeigniter
and my directory structure

enter image description here

My source folder contains the .htaccess file containing the following code

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]


Home.php

class Home extends CI_Controller{
public function index(){
$this->load->view('View');
}
}


view.php

echo "HI this is my first codeigniter program";


I have tried the following url
http://localhost/Codeigniter/
but I
get a 404 error, however
http://localhost/Codeigniter/home
loads the correct result even though my actual root folder is Codeigniter

how to solve this problem?

Answer

Change route file in this following path:-

CodeIgniter/application/config/routes.php

$route['default_controller'] = 'required_controller';

Then only you can access the following url

http://localhost/Codeigniter/