mod_rewrite conversion

May 17, 2007 at 8:52 AM
Hi...can iirf handle the following apache mod_rewrite rules?

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|styles|js|inc)
RewriteRule ^(.*)$ /index.php/$1 L

The CodeIgniter framework appends its URI segments onto index.php (e.g. and the above mod_rewrite rule for apache removes the index.php from the visible URL (except if the user is trying to access the files index.php or robots.txt or the directories images, styles, js or inc). There is no limit as to how long the URL might be (possibly "/news/article" or "/news/article/paragraph/line").

I have been unable to get this rule working with iirf...and therefore might have to go back to apache.
Any help would be much appreciated, Thanks alot!

------------ -> ->

(news, article, paragraph, line are random examples these can be anything)

Jul 30, 2008 at 12:00 AM
I am curios about this as well. I have been trying to figure this out for a couple of days now with no real luck.

Any help would be great.
Jul 31, 2008 at 8:39 PM
Edited Jul 31, 2008 at 9:10 PM

What specifically are you trying to figure out?
The original question from way back - the rule and condition that works for me is this:

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

You don't need a condition on that rule. You could just put the entire thing together in the rule itself:

RewriteRule ^/(?!(index\.php|images|robots\.txt|styles|js|inc))(.*)$ /index.php/$2    [L]

I don't think the PCRE regular expression engine supports the syntax that has the negation symbol (!) at the beginning of the pattern. But you can stilla ccomplish what you want with a negative lookahead.