htaccess rewrite trouble htaccess rewrite trouble codeigniter codeigniter

htaccess rewrite trouble


This is my .htaccess on CentOS:

RewriteCond $1 !^(index\.php|images|robots\.txt|favicon\.ico)RewriteRule ^(.*)$ index.php?/$1 [L]

Note the question-mark before the forward-slash.

I think the reason for this relates to running PHP as FastCGI. I believe the questionmark makes the preceding character optional (i.e. it would also match index.ph). I've tried researching this a bit more but couldn't find a definitive reason. I think I just tried every variation on the rewriterule I could find when I was looking and didn't bother asking why it worked.

Glad to be of help.