.htaccess
Some defaults
Options +ExecCGI +MultiViews -Indexes
ExecCGI allows CGI programs to be run in this directory.
MultiViews allows Apache to process a request by guessing a file extension; i.e., http://example.com/images/first
could lead to either http://example.com/images/first.jpg
or http://example.com/images/first.png
, whichever is available.
Indexes allows web users to see the directory listings in a directory.
Permissions
The Files directive can be used to conveniently hide files that ought not be visible to the outside world. This directive hides Perl modules and POD documents in this directory and all subdirectories (excepting perhaps subdirectories with their own .htaccess files):
<Files ~ "\.(pm|pod)$"> Order allow,deny Deny from all </Files>
Note that if you really want to make sure a file stays hidden on the web, prefix its filename with ".ht". Apache comes standard making all files that begin with .ht invisible (using the same mechanism as above, actually).
ForceType: Pretend a file has a different type
If you'd like to create a custom file extension for, say, a PHP or CGI script, ForceType is a nice tool. To use this to force files with the extension .pro
to be used as (Apache-executed) PHP scripts, something like this should work:
<Files ~ "\.pro$"> ForceType application/x-httpd-php </Files>
This all depends on which MIME types (and pseudo-types) the server has set up. cgi-script
is usually the type for CGI scripts.