Default htaccess file for CodeIgniter PHP framework

CodeIgniter is one of the PHP framework with small footprint and its not working properly like we are receiving the “index.php”  file name in the URL which is causing the SEO result. To resolve the issue refer to the following code under the main .htaccess file.

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

To understand the mod rewrite rule, you can also refer to the official codeigniter site.

mod rewrite understanding

 

About Anant 386 Articles
Senior technical writer