An improved .htaccess file to remove index.php in CI
A quick update of the .htaccess to remove the index.php, while still protecting the application folder.
The previous method I used meant having to add every real file or directory to the .htaccess to allow them to be accessed. The updated way checks if the requested file/directory exists and if need rewrites to the index.php.
If you need to protect more directories separate them with | i.e. application|modules
RewriteEngine On
RewriteRule ^(application) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Golden. I have been looking all over how to do this and you have it all wrapped up! Good job.
TheServant
18 Sep 09 at 6:11 pm