Question:
Can I run CGI scripts in a directory other than the cgi-bin directory?
Answer:
For security reasons, we recommend that you run your CGI programs from the provided cgi-bin directory, which was created for that purpose. However, although we discourage the use of CGI programs outside of the cgi-bin, you can do so through the use of a .htaccess file.
Software:
Apache, Perl
Detail:
You will need to create a .htaccess file in the directory that you want the scripts to be run and tell it to allow the directory to run CGI scripts and what kind of files are CGI scripts.
Solution:
You will want to create an .htaccess file in the directory that you want to allow the CGI scripts to run. In the .htaccess file you want to add the following information:
Options ExecCGI Includes FollowSymLinks
AddHandler cgi-script cgi pl
<Limit GET POST>
Order Deny,Allow
Deny from none
Allow from all
</Limit>
This will allow cgi scripts ending with .pl and .cgi to be run. You will need to make sure that your scripts have execute permissions as well.