RewriteRule for Zend Framework

Aug 7, 2008 at 11:30 AM
Edited Aug 7, 2008 at 11:38 AM
I need rule that change all URLs to "index.php". Exception should me made for URLs with jpg and gif extensions.

/ -> /index.php
/test.php -> /index.php
/pages/1/ -> /index.php
/pages/1/test.php -> /index.php
/public/img/test.gif -> /public/img/test.gif 

 
I tried    RewriteRule ^(.*)(?!(gif|jpg))(.*)$ /index.php [L,U]   but didn't succeed. 

All URLs rewrites to "index.php". Including with gif and jpg extensions. :-(  
Aug 7, 2008 at 2:05 PM

Same history with:

RewriteRule ^[\w/\%]*(?:\.(?!(?:gif|jpg)$)[\w/\%]*$)? /index.php [L,I,U]

 

Aug 7, 2008 at 2:25 PM

Solution is:

RewriteRule ^/(.*(gif|jpg))$ /$1 [L,I,U]
RewriteRule ^(.*)$ /index.php [L,I,U]

 

Coordinator
Aug 8, 2008 at 4:57 AM
Glad you figured it out.
The TestDriver.exe can be really useful for these situations.