Apache .htaccess File Help For Non Techies
The .htaccess file is a very powerful text control file found on apache servers (note: even if they run on windows) that allows control over various components of the web server.
For example the .htaccess file can be used to:
- Password protect pages/directories
- Block users
- Do redirects
- Change default home page
- Add file extensions
- etc
What exactly you can do with the file is determined by the server administrator, and so just because it is possible to use the .htaccess file to configure, say password
protection, it doesn't mean that you will be able to do it on your hosting package.
Name and structure and Flow
The file name is itself very confusing as there isn't really a name just a file extension. Most files take the form name.extension. However
the .htaccess is just a file extension.
The file itself is a simple text file edited using a text editor like notepad (not word) with a single directive (instruction) per line.
There can be multiple .htaccess files on a website but only one per directory. Instructions in a .htaccess file in a parent directory will affect the sub directory unless
specifically blocked or overwritten by a .htaccess file in the sub directory.
That is to say child directories automatically inherits the .htaccess file directives from the parent directory as the sketch below attempts to show.

Editing the .htaccess file
Editing the file isn’t difficult, however you
should be careful when using/editing this file as
incorrect editing can cause sever errors. After any
changes you should always take a look at your site
in a browser to make sure it loads ok.
In order to help then you may want to use a .htaccess
editing tool. There are a number of online ones like
http://www.htaccesseditor.com and there is
htaccessible which is a windows based program.
The online tools and the htaccessible programs
generate redirects using the redirect command.
However use of mod rewrite is more common and trying
to use the redirect command in an .htaccess file on
a server with module rewrite enabled usually causes
a server error. See Web Page Redirects
If your main concern is password protecting your
website then you may want to look at the
htpassword generator. The
Password
protect web pages article has more information
on how to protect pages.
Related Articles and Resources:
|