The Apache Server has the ability to alter it's behavior on a per-directory basis. Rather than specifying explict entries in the httpd.conf file, one can instead make entries in a .htaccess in the directory being served.
Before you go and start overriding Aapache's behavior, you must explictly allow overrides in the httpd.conf file.
The most agressive context is (httpd.conf):
Technically, you can also add MultiViews to the Options line, though if you're not dealing with multiple languages it can cause other problems (like serving up pages you don't expect). The XBitHack allows pages with their executable bit set to be processed as a server-parsed html document.
This represents the more common uses of .htaccess.
Prevent Serving Pages From This Directory
You may be asking why you'd want to do that. Suppose you have a
set of PHP scripts which need to include data or
PHP fragments. Instead of shuffling it outside of the document
tree, which is never a bad idea from a web perspective, you can
instead add this to the .htaccess file:
deny from all
ErrorDocument 404 /404.php
This says load the 404.php upon failure.
php_value include_path ".:/usr/lib/php:/usr/local/lib/php:/your/directory"
Here PHP will check the current directory, then two common places for
PHP libraries, then a directory you specify (which might be a subdirectory
in your web space that you blocked serving access to).