Wednesday, 29 July 2015

How To Remove index.php in Codeigniter

First Of All Please Open config.php file which is in application folder

1.  please remove index.php from Below line

$config['index_page'] = "index.php"
 
2. add new .htaccess file 
  
 
Your_website_folder/

application/

assets/

system/

.htaccess <——— this new file 

3. Enter code in .htaccess file 

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
 
 
 
Above changes will reflect when you call url like
 
http://localhost/my-project/controller-name/action-name 
------------------------------------------------------------------------------