Jon Morgan
Jon Morgan

Reputation: 3

home.php not being accessed in codeigniter

I have a few sites set up on CI but latest one isn’t cooperating: browsing the domain doesn’t trigger home.php. I get “No input file specified”. I must be missing? (btw, when I put a test index.php file in root the echo code does render) Here's what I've got set up -

//permissions:
//all subdirectories & file set to 755

//config.php:
$config[‘base_url’] = ‘http://example.com’;
$config[‘index_page’] = ‘home’;

//htaccess in root:
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

//routes.php:
$route[‘default_controller’] = “home”;
$route[‘404_override’] = ‘’;

//home.php:
class Home extends CI_Controller {
public function index()
 {
  $this->load->library('session');
  $this->load->view('main_view');
  }
}

My settings seem to mirror those of my other the working CI sites but I’m definitely missing something. Would appreciate feedback on what else I should look for. Thanks

Upvotes: 0

Views: 70

Answers (2)

Will
Will

Reputation: 111

Since you're removing index.php from your URI, you don't need to specify an index_page in config.php. Setting $config['index_page'] = ''; should solve your problem. You should be fine leaving your $route['default_controller'] as it is, since CodeIgniter automatically defaults to the index method.

Upvotes: 1

olivier pointin
olivier pointin

Reputation: 26

Your 'default_controller' config must be 'home/index'

Also be sure you placed the default config on the bottom of the file. In the CI routes files, always start from the most specific to the most general ...

Upvotes: 0

Related Questions