trouble using .htaccess to control access to files

I am wanting to control how files are accessed in one of my folders. I want to be able to access /cgi-bin/program.cgi but only from /admin/index.html
I don't want to allow access directly by typing in the URL but how can you only access it if you are coming from /admin/index.html

I have more than one files in the same directly that I want to do that to but with different ext. Here is what I have tried so far but I don't think that it is all correct. This .htaccess is in my /cgi-bin folder

Code:
<FilesMatch "^prog\.cgi$">
   SetEnvIfNoCase URI "^/admin/index.html" good_URI=1
order allow,deny
deny from all
allow from env=1
</FilesMatch>

<FilesMatch "^anotherprog\.pl$">
   SetEnvIfNoCase Referer "^/admin/index.html" good_URI=2
order allow,deny
deny from all
allow from env=2
</FilesMatch>
Also my setup
Apache 2.0.52
PHP 4.3.10
Perl 5.8.1

I do have Allowoverride to All in the httpd.conf file for the cgi-bin. I don't know if using the Referer is the best way to go or if I should use the URI instead of the Referer.

Thank You,
Charles

 

 

 

 

Top