Codeigniter beginners had faced this problem quite often, but the solution is simple and easy just follow the steps below

Step1:

Download the latest codeigniter and configure into your localhost. Check once after completing the configuration.

http://localhost/codeigniter

Step 2:

Next go to codeigniter folder and create one file name is “.htaccess”.Paste the below code.

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

Step 3:
Create login controller go to

Codeigniter->application->controllers

File name “login.php”

<?php
class login extends CI_Controller {
public function __construct(){
parent::__construct();
}
public function index() {
echo “Hi this is sudhakar”;
}
}
?> 

After completing this process, you will call controller name in browser with out index.php

1) You don’t have .htaccess file in root directory

http://localhost/codeigniter/index.php/login

2) You have .htaccess file in root directory

http://localhost/codeigniter/login/