Forum Moderators: phranque

Message Too Old, No Replies

Disabling cgi-bin with .htaccess

how to make files in /cgi-bin/ treated like regular files?

         

laughingeyes

10:40 pm on Jul 27, 2007 (gmt 0)

10+ Year Member



Hi,

Is there any way to make files located in /cgi-bin being treated like regular files, not as scripts?

In other words, I'd like Apache to recognize all files in a /cgi-bin as being eligible for processing as normal documents, rather than for execution.

Is it doable? If so, what do I put in my .htaccess file?

Thanks!

jdMorgan

7:55 pm on Jul 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could conceivably do this, but it's also possible that your host has a ScriptAlias directive in the server configuration (see Apache mod_alias). If so, this will be impossible to override with any .htaccess code. Also, even if this is not the case, it might become the case if you ever changed hosts.

So I would strongly advise you not to use cgi-bin for anything but executable scripts -- It's pretty much a standard "reserved" directory name.

You may be able to mark the files as non-executable by placing an .htaccess file into /cgi-bin which contains:

 Options -ExecCGI 

but again, I don't recommend fooling around with the /cgi-bin directory...

Jim