Nagging mod_rewrite problem


I’ve got a small mod_rewrite problem, where if i try using mod_rewrite at the same time as the addhandler for a custom php version i get error 500. If i remove the custom php from the .htaccess file, it works the way i want it to. The same goes if i remove the mod_rewrite code the custom php runs fine. I know the custom install of php is working fine because it is currently being used on all my other sites without any problems.
The only thing i have in the .htaccess is as follows:

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

RewriteEngine On

RewriteCond $1 !^(index.php|application/images|application/scripts|application/css|application/content|application/settings|favicon.ico)
RewriteRule ^(.*)$ index.php?$1 [L]

Can anyone spot what is wrong with it? Or show me another way of accomplishing the same thing with mod_rewrite. Thanks for any reply and or suggestions