1

In routes.php i've set the default controller as so:

$route['default_controller'] = 'index_controller';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

index_controller is in the controllers folder titled: index_controller.php The content of index_controller is:

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

class Index_controller extends CI_Controller {

 function __construct()
 {
   parent::__construct();
 }

 function index()
 {
   $this->load->helper('url');
   $this->load->view('login_view'); 
 }

}
?>

The error I get is:

404 Page Not Found The page you requested was not found.

3
  • which version of codeigniter are you using?? Commented Oct 15, 2015 at 9:14
  • @user3574766 Rename $route['default_controller'] = 'index_controller'; to Just $route['default_controller'] = 'Index' (Take note the Captial I) Commented Oct 15, 2015 at 9:41
  • Route can point to lower case name, but if it is CI v3+ your controller file need to be ucfirst (i.e. Index_controller.php). Commented Oct 15, 2015 at 10:56

2 Answers 2

1

If the version of your codeigniter is 3, then file name should start with capital letter.

Next, have you added .htaccess file ?? if not access the url with index.php. or use following code to remove the index.php from url.

RewriteEngine On
RewriteBase /CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 

add this file in root with name .htaccess

Sign up to request clarification or add additional context in comments.

1 Comment

Did the answer helped you?? Please add comment here what you had missed in your code. It will hwlp others.
0

It looks like index_controller is a Controller name, not URL. You should write URL.

For example;

$route['default_controller'] =  'home';
$route['home']               =  'back/homeController';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.