###Turn indexes on and remove server information Options +Indexes ServerSignature Off ###Close and lock all indexes Options All -Indexes ###Turn on indexes and use Fancy indexing IndexOptions +FancyIndexing ###Other options for Fancy indexing Options +indexes ServerSignature Off IndexOptions Type=text/plain IndexOptions FancyIndexing IndexOptions FoldersFirst IndexOptions NameWidth=40 IndexOptions SuppressLastModified IndexOptions SuppressSize IndexOptions SuppressDescription IndexOptions SuppressRules IndexOptions SuppressIcon IndexOptions HTMLTable IndexOptions SuppressColumnsorting IndexOptions IgnoreClient IndexOptions SuppressHTMLPreamble ReadmeName FOOTER.html HeaderName HEADER.html ###The following can be clipped and added to the header file for your indexes to add additional sorting options for Fancy indexing.
Show me a Sorted by Matching
###Let's say you have a directory with .jpg, .gif and .png image files. You only want the .png files to show in the directory listings. Add this line to your .htaccess IndexIgnore *.gif *.jpg ###define custom error pages for: ###401 - Authorization Required ###400 - Bad request ###403 - Forbidden ###500 - Internal Server Error ###404 - Wrong page ErrorDocument 401 /401.shtml ErrorDocument 403 /403.shtml ErrorDocument 404 /404.shtml ErrorDocument 404 /favicon.ico ErrorDocument 403 https://secure.htaccesselite.com ErrorDocument 400 /400.shtml ErrorDocument 405 /405.shtml ErrorDocument 406 /406.shtml ErrorDocument 409 /409.shtml ErrorDocument 413 /413.shtml ErrorDocument 414 /414.shtml ErrorDocument 500 /500.shtml ErrorDocument 501 /501.shtml ###Here's another .htaccess file with ErrorDocument enabled. This time, we are displaying messages instead of going to a different URL: ErrorDocument 401 "

Error 401

Authorization Required.

" ErrorDocument 403 "

Error 403

Forbidden.

" ErrorDocument 404 "

Error 404

Not Found.

" ErrorDocument 500 "

Error 500

Internal Server Error.

" ###Deny access to certian Ip numbers deny from 208.115.111.73 deny from 208.115.111.73 #####Redirect everyone to different site except 1 IP address (useful for web-development) ErrorDocument 403 http://www.someothersite.com Order deny,allow Deny from all Allow from 24.33.65.6 ###Set the Timezone of the server: SetEnv TZ America/Indianapolis ###Turn off the ServerSignature ServerSignature Off ###Force Files to download, not be displayed in browser AddType application/octet-stream .avi AddType application/octet-stream .mpg ###Show the source code of dynamic files If you'd rather have .pl, .py, or .cgi files displayed in the browser as source rather than be executed as scripts, simply create a .htaccess file in the relevant directory with the following: RemoveHandler cgi-script .pl .py .cgi ###Require password for 1 file: AuthName "Prompt" AuthType Basic AuthUserFile /home/askapache.com/.htpasswd Require valid-user ###Protect multiple files: AuthName "Development" AuthUserFile /.htpasswd AuthType basic Require valid-user ###Allow from apache.org but deny from foo.apache.org Order Allow,Deny Allow from apache.org Deny from foo.apache.org ###Allow from IP address with no password prompt, and also allow from non-Ip address with password prompt: AuthUserFile /home/www/site1-passwd AuthType Basic AuthName MySite Require valid-user Allow from 172.17.10 Satisfy Any ###block access to files during certain hours of the day Options +FollowSymLinks RewriteEngine On RewriteBase / # If the hour is 16 (4 PM) Then deny all access RewriteCond %{TIME_HOUR} ^16$ RewriteRule ^.*$ - [F,L] ###Forbidding all files: order allow deny deny from all allow from ###Forbidding a group of files by mask: order allow,deny deny from all ###Defines access to a file by its extension. For example, forbidding web visitors to access files with the "inc" extension: order allow,deny deny from all ###You can forbid a particular file using its name and extension. order allow,deny deny from all ###Setting a Password for a directory: AuthName "Private zone" AuthType Basic AuthUserFile /pub/home/your_login/.htpasswd require valid-user ###For example, we create the following .htaccess file in the protected directory: AuthName "For Registered Users Only" AuthType Basic AuthUserFile /pub/site.com/.htpasswd require valid-user ##Once you have created the required usernames and passwords, you need to place them inside a .htpasswd file. Open a program such as Notepad and copy the username and password combinations that you generated using the htpasswd generator utility and place each username/password combination on it's own line. Here's a sample .htpasswd file with 3 username/password combinations specified: user:XsexPxQgcBoTc webmaster:LMmm0OcSGsnI2 admin:oZ8O/CyiGjtHE ###To redirect a visitor to http://site.com, add the following to .htaccess Redirect / http://www.site.com ###SEO Friendly redirects for bad/old links and moved linksFor single moved file: Redirect 301 /folder/oldfile.html http://www.htaccesselite.com/folder/newfile.html ###Displaying different pages depending on the visitor's IP address:For example, redirecting visitors with IP 192.12.131.1 to the page about_my_site.html: SetEnvIf REMOTE_ADDR 192.12.131.1 REDIR="redir" RewriteCond %{REDIR} redir RewriteRule ^/$ /about_my_site.html ###To change the page that will be displayed when a visitor access a directory, write:(Internal Redirect?)It is possible to specify several pages::DirectoryIndex index.shtml index.php index.php3 index.html index.htm DirectoryIndex index.shtml ###Add Audio Mime Types AddType audio/x-midi mid midi AddType audio/x-mod mod AddType audio/x-voc voc AddType audio/x-669 669 AddType audio/x-s3m s3m AddType audio/x-xm xm AddType audio/x-mtm mtm AddType video/x-flc flc ###Make Gzipped Music on WebTV display "Getting Song" instead of "Getting Page". AddEncoding x-compress .gz