[kwlug-disc] htaccess

Richard Weait richard at weait.com
Mon Jan 4 14:14:55 EST 2010


On Mon, Jan 4, 2010 at 2:09 PM, Richard Weait <richard at weait.com> wrote:
> On Mon, Jan 4, 2010 at 1:58 PM, Insurance Squared Inc.
> <gcooke at insurancesquared.com> wrote:
>> Is there a way to have some htaccess directives only apply to a main folder,
>> but not subfolders?  or even better, to have it apply to all except 'some'
>> subfolders?
>> I'm using a wordpress install that uses htaccess to redirect pages, but it's
>> affecting some subfolders and causing other stuff to not work.
>
> Multiple .htaccess files.  The .htaccess file in the pwd overrules
> those above it in the tree.  No local .htaccess file means look up the
> tree until you find one.
>
> ".htaccess files (or "distributed configuration files") provide a way
> to make configuration changes on a per-directory basis. A file,
> containing one or more configuration directives, is placed in a
> particular document directory, and the directives apply to that
> directory, and all subdirectories thereof."
>
> http://httpd.apache.org/docs/1.3/howto/htaccess.html

Or I could read further and find that it reads all .htaccess files
above the current directory as well and applies all directives, with
closer directives overriding further...

"Further note that Apache must look for .htaccess files in all
higher-level directories, in order to have a full complement of
directives that it must apply. (See section on how directives are
applied.) Thus, if a file is requested out of a directory
/www/htdocs/example, Apache must look for the following files:

    /.htaccess
    /www/.htaccess
    /www/htdocs/.htaccess
    /www/htdocs/example/.htaccess

And so, for each file access out of that directory, there are 4
additional file-system accesses, even if none of those files are
present. (Note that this would only be the case if .htaccess files
were enabled for /, which is not usually the case.)"




More information about the kwlug-disc mailing list