Using .htaccess to remove Codeigniter’s index.php file
Posted on: August 20, 2012 by Tyler H.T. Cipriani
Quick post today. I was just finishing up a codeigniter project and saw an error in the docs in the CodeIgniter User Guide Ver. 2.1.2 § CodeIgniter URLs under the section heading, “Removing the index.php file” it shows an .htaccess file example:
1 RewriteEngine on
2 RewriteCond $1 !^(index\.php|images|robots\.txt)
3 RewriteRule ^(.*)$ /index.php/$1 [L]
The RewriteRule
should not have the forward slash (/
) before index.php
.
To function as expected the RewriteRule
should read:
1 RewriteEngine on
2 RewriteCond $1 !^(index\.php|images|js|css|robots\.txt)
3 RewriteRule ^(.*)$ index.php/$1 [L]
← View Weblog