Table of Contents

.htaccess examples

allow browse

Options +Indexes

prevent browse

Options -Indexes

error 404

ErrorDocument 404 /_error/docnotfound.html

fancy indexes

This code is for Apache 1.3. The FancyIndexing directive has been removed in Apache 2. The same functionality is available through the FancyIndexing option to the IndexOptions directive.

FancyIndexing On
IndexOptions NameWidth=* SuppressDescription
IndexIgnore .htaccess

redirect match

RedirectMatch permanent docs[/?]$ /some/new/relative/path/to/docs/

basic authentication

AuthGroupFile /dev/null
AuthName "Some Name"
AuthType Basic
AuthUserFile /full/server/path/to/.htpasswd
require valid-user

sample .htpasswd

use the htpasswd utility to generate or modify .htpasswd files

joe:Nn.TGkDGRIDnc
bob:njh4snJ8rxaZk

redirect see other

Redirect seeother /relative/path/to/somefile.html http://host/full/path/to/newfile.html