What
is '.htaccess'?
Among
other things, this file can be used to restrict access to other
files and web pages. When a request is made for a web page,
the web server instantly checks for an '.htaccess'
file. The server begins this check by looking for '.htaccess'
in the root web directory, and then down the directory
tree until it reaches the the folder where the requested file
resides. Since the placement of the '.htaccess'
file determines when it is executed, it can only be
used to restrict access in certain subdirectories.
NOTE:
Do NOT edit the '.htaccess' file if you are using MS FrontPage.
FrontPage uses the '.htaccess' file. Editing it may cause errors
in your configuration.
To use, first
create a '.htaccess' file in the directory
that you want protected.The '.htaccess' file can be placed
in one or more of your "/home/username/your_domain-www"
subdirectories.
Restricting
Access: Password Protection
The directory
you want protected must have an '.htaccess'
file in it like the following:
AuthUserFile
/home/username/.passwd
AuthGroupFile /home/username/.group
AuthName "Access by password Only"
AuthType Basic
<Limit GET POST>
require group groupname
require user username
</Limit>
Groups and
users are stored in the '.group' file. Passwords
are stored in '.passwd' file. The '.htaccess'
file looks for these files in the "/home/username/"
directory. Do not attempt to edit these manually. Jumpline
has a special script you can use to manage your '.group'
and '.passwd' files (the "Webmister" script).
Redirects
Redirecting
allows you to send the user to, for example, 'new.html'
when they are attempting to access 'old.html'. To see
this example in practice, simply add the following line to the
'.htaccess' file. This should be typed as one single
line, without breaks.
Redirect
/directory_name/old.html http://your_domain.com/directory_name/new.html
Apache
has an very informative FAQ's Page on Redirects