if you read
this article then it you will tell you that the context of RewriteCond and RewriteRule can be any of: server config, virtual host, directory, .htaccess.
I am looking into this myself because at the minute I use virtual hosts but I want to use userdirs and use rewrite rules to map the domains to the userdirs. So those rules under Virtual User Hosts of the pratical solutions article look very promising to me. As for the cgi directory I think something like this would do:
Code:
#taken from the default apache httpd.conf file
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
# Allow each user to have dir to exec cgi scripts
<Directory "/home/*/public_html/cgi-bin">
Options ExecCGI
SetHandler cgi-script
</Directory>
As far as I am aware you can have as many scriptalias directives as you want as long as you use different names:
Code:
ScriptAlias /cgi-bin/ /home/user/cgi-bin/
ScriptAlias /cgi-shared/ /home/cgi-shared/