httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suomi <apa...@ayni.com>
Subject Re: [users@httpd] <Directory> and <Location>
Date Wed, 25 Aug 2004 05:38:38 GMT
Hi Dan
check out the sequence which the <Location> and <Directory> directives 
are applied in. that fooled me once many days:

If you use directory, files, and location directives on a web site, you 
must consider the following processing sequence:

the directives directory, directorymatch, files, filesmatch, location, 
locationmatch are processed in that order, which means that a files 
directive will overrun a directory directive (if that where possible), 
and a location directive will overrun both of them

be aware that the location, locationmatch directives are processed last, 
and they may invalidate any directory, directorymatch and files, 
filesmatch directives. If you have a location, locationmatch directive 
in the general setup in httpd.conf, it will overrun all 
directory,directorymatch and files,filesmatch directives you specify in 
particular virtual-server directives.

suomi

Dan Goodes wrote:
> Hi guys,
> 
> Hopefully someone here can lend a hand.
> 
> I have an Apache-1.3 system here that isn't behaving as expected (I can't
> upgrade to Apache-2, because some 3rd party modules I use don't work in
> 2.0 yet).
> 
> In the working configuration, I have a series of <Directory> statements
> which set environment variables, and perform other functions:
> 
> <Directory /some/path>
> <Directory /some/path/subdir1>
> <Directory /some/path/subdir2>
> 
> and so on.
> 
> I want to put in some redirection rules in each location, that direct
> requests to different URLs based on the Directory (assume the Directory
> sections are closed off):
> 
> <Directory /some/path>
>    .... Some Rewrite Directives
> <Directory /some/path/subdir1>
>    .... Other Rewrite Directives
> <Directory /some/path/subdir2>
>    .... Still Other Rewrite Directives
> 
> This obviously doesn't work as expected, since the Rewrite directives for
> /some/path will be run, rendering those for subdir1 and subdir2 useless.
> 
> So I decided to look at Location directives, as these are applied in the
> order they appear in the config file. Assume I have
> 
> Alias /path/ /some/path/
> 
> then:
> 
> <Location /path/subdir1>
>    .... Other Rewrite Directives
> <Location /path/subdir2>
>    .... Still Other Rewrite Directives
> <Location /path>
>    .... Some Rewrite Directives
> 
> should do what I want. I.e. If the path matches /path/subdir1 then those
> rules will be applied, and wont be over-ridden by those for /path. Right?
> Or have I completely missed the point?
> 
> The next question I have is, if I do it that way, *NONE* of my Location
> directives are even read. So nothing at all under /some/path has any
> directives applied to it. A request to
> 
> /path/<anything>
> 
> has no directives applied to it, Rewrite or otherwise.
> 
> Why is that? How can it be that the <Directory> statements work, and
> corresponding <Location> statements don't?
> 
> Any help/advice would be greatly appreciated (and will keep upper
> management off my case!).
> 
> 
> Regards,
> 
> Dan Goodes  :  Systems Programmer  :  dang@planetmirror.com
> 
> Help support PlanetMirror - Australia's largest Internet archive
> by signing up for PlanetMirror Premium : http://planetmirror.com
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message