To prevent infinite looping add an extra RewriteCond
line on top of your rule like this:
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
prevents looping by checking an internal mod_rewrite
variable REDIRECT_STATUS
which is set to 200 after first successful internal redirect.