I want normal URL like www.sample.com/controller not www.sample.com/public/index.php/controller.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCo
okay , this is how I solved this problem :
you need 2 .htaccess files
the first one in root path "/.htaccess" of your project
the second one in the public folder "public/.htaccess"
and here is the first one "/.htaccess"
# this is my version (Nassim) of the htaccess file , I use this one in the root directory "/"
# of the project and a second .htaccess in the public directory
DirectoryIndex /public/index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./public/index.php/$1 [L,QSA]
and the second one (comes with CI installation): "public/.htaccess"
# I recommend you remove `IfModule`. Because if you need mod_rewrite,
# you don't need `IfModule`. If you don't need it, you don't need this file
# at all.
RewriteEngine On
RewriteCond $1 !^(index\.php|images|assets|doc|data|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]