With the Apache/mod_rewrite config below i get a 403 forbidden error for any CGI scripts on the root /var/www/ I don't get any error for static files.
Scripts out of root dir i.e. /var/www/random/script.cgi work normally without errors.
With RewritedEngine turned OFF CGI scripts work normally even in the root /var/www/
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
Options SymLinksIfOwnerMatch
AllowOverride All
<IfModule mod_rewrite.c>
RewriteEngine on
</IfModule>
</Directory>
<Directory /var/www/>
Options +ExecCGI
Options SymLinksIfOwnerMatch
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
AddHandler cgi-script .cgi
DirectoryIndex index.cgi
</Directory>
<Files "index.cgi">
SetHandler perl-script
PerlHandler ModPerl::PerlRunPrefork
Options ExecCGI
PerlSendHeader On
allow from all
</files>