HowTo: Run CGI in any directory
CGI or Perl scripts are generally run through the cgi-bin folder such as www.domain.com/cgi-bin/. This separates your script files from the rest of your website allowing you to better manage your files.
What if however you do not want to be restrained to the cgi-bin folder and have the ability to run CGI or Perl scripts anywhere in your public_html folder? Simply by uploading a .htaccess to your root web directory (usually public_html) with the following:
Options +ExecCGI
AddHandler cgi-script .cgi .pl
Once you’ve uploaded the .htaccess file, you will then be able to execute any CGI or Perl script that ends with the .cgi or .pl file extensions.



