Code Igniter, Not Found 404 Error Code Igniter, Not Found 404 Error codeigniter codeigniter

Code Igniter, Not Found 404 Error


That error can happen for many reason. here is some
1.make sure you have main.php under controllers folder and inside main.php you should have a class Main which extends CI_Controller like this

class Main extends CI_Controller

2.make sure your .htaccess working.If your previous step is ok then try to hit this link

your_site_url/index.php/main/cek_login//make sure cek_login function exists inside the controller

If this link works you may have .htaccess problem
3.your cpanel error tells that your .htaccess not working.
check your server if it has main .htaccess which is redirecting your site if file not found.If so then your sub .htaccess will not work.
I think this is the main reason that produce your error.


Please check your config.php

$config['base_url']

then check 'routes.php', add the line below

$route['main/(:any)'] = 'main/index';

Then, add your login check in your controller file.

// Login check    $exception_uris = array(            'main/cek_login',            'main/cek_logout'    );    if (in_array(uri_string(), $exception_uris) == FALSE) {        if ($this->user_m->loggedin() == FALSE) {            redirect('main/cek_login');        }    }


Just upload a test file and check document root of your server directory.

1.Create a file info.php2. Write code

<?php phpinfo();

3.Open any broswer and type http://www.yourdomain.com/info.php

  1. If it works fine, find document roon in listed information of info.php page

  2. If this http://www.yourdomain.com/info.php not works, contact your server support team to fix it. Basically problem with server configuration, not with Codeigniter files.