This article will help you understand and
build your knowledge of the .htaccess file you see when you run an Apache Web Server like ours. '''''Note''': Article is still under editing''
==What is a .htaccess file?==
It is Apache's directory-level configuration file (as opposed to httpd.conf, which is the main server configuration file) that provides the governing rules of how
a web server should be ran/behave. When it is placed in a particular directory, the rules in it apply to that directory and all the subdirectories thereof.
to the use and configuration of the .htaccess file.
==What is a .htpasswd file?==
===Change the Default Directory Index File===
It can be used to
chnage the default index file which is normally index.html, index.ext... to anything like foo.ext or whatever name/extension you prefer. To do this, use:
<pre>DirectoryIndex foo.ext home.html home.php foo.php</pre>
===Customizing Error Handling/Error Pages===
If you have ever wondered how people
chnage their 404, 500... error pages to something like lost.ext, then you will like this code in your .htaccess file:
Where [Error Number] is replaced with the error number, and [Error Document] is replaced with the path
fo the error document which can be internal or external as in:
<pre>http://www.anothersite.com/foo.ext or /foo.ext</pre>
===Limiting Access by User===
This part lets you use a .htaccess/.htpasswd user login system
For this example you
places a .htpasswd file in the path (/htpasswd/path/to/). In the .htpasswd file will be: <pre>[user]:[password]</pre> Normally you have to encrypt the password but if you are using The [[ Uniform_Server|Uniform Server]], then you do not need to do that. You ca also use this example to protect another directory from just 1 .htaccess file:
are intrested in doing this for just specific files then use:
The ''Require'' statement is used to list valid users or groups of users
so if you just want 1 .htpasswd file , but want multiple protected areas, then you can use:
<pre>Require user username1 username2 username3...</pre>
Or if you want to use it in groups then you can use:
Groupname2: username1 username4 username5 ....
As you can see a username may be in as many
group as you like while others may just be in 1.
[[Category: Troubleshooting ]]