EllisLab/CodeIgniter — Issue #684: Default .htaccess (in User Guide) can conflict with controllers
Author: svivian
Created: 2011-11-20 14:28:58+00:00
State: open

The `RewriteCond` line of the sample `.htaccess` file is incorrect. The line is:

RewriteCond $1 !^(index\.php|images|robots\.txt)

However, if you have a controller that starts with "images" (or any other folder you happen to add to the line), opening the appropriate URL bypasses CI and the server returns a 404 Not Found error. I had this when I added my "js" (Javascript) folder to the list, but then created a Json controller.

The current one blocks many common files such as favicon.ico, sitemaps, webmaster tools verification files and more. It even blocks the CI user guide! Here's a simplified version of what I'm using that solved the problem:

RewriteCond $1 !^(([^/]+\.[^/]+)|images/|user_guide/)

The first part checks for any file with a dot in it, then for folders, specifically ending with `/`. Hope this helps :)