You want to designate a directory that contains only CGI scripts.
Add the following to your httpd.conf file:
ScriptAlias /cgi-bin/ /www/cgi-bin/
A CGI directory will usually be designated and enabled in your default configuration file when you install Apache. However, if you want to add additional directories where CGI programs are permitted, the ScriptAlias directive does this for you. You may have as many ScriptAlias'ed directories as you want.
The one line previously introduced is equivalent to these directive lines:
Alias /cgi-bin/ /www/cgi-bin/ <Location /cgi-bin/> Options ExecCGI SetHandler cgi-script </Location>