.htaccess files are often used to specify the security restrictions for the particular directory, hence the filename "access". The .htaccess file is often accompanied by a .htpasswd file which stores valid usernames and their passwords.
Servers often use .htaccess to rewrite long, overly comprehensive URLs to shorter and more memorable ones.
Use allow/deny to block users by IP address or domain. Also, use to block bad bots, rippers and referrers.
Enable server-side includes.
Control how the server will react when no specific web page is specified.
Customized error responses
Changing the page that is shown when a server-side error occurs, for example HTTP 404 Not Found.
Instruct the server how to treat different varying file types.
.htaccess files allow a server to control caching by web browsers and proxies to reduce bandwidth usage, server load, and perceived lag.