homepage Welcome to WebmasterWorld Guest from 54.242.200.172
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
<Location> directives override all <Directory> directions ?
1script




msg:4535538
 8:37 pm on Jan 12, 2013 (gmt 0)

I wonder if someone can offer a path to circumvent this Apache limitation (or feature - whatever it is, I cannot do what I need because of that, so for me it is a limitation)

From Apache 2.2 manual:


Regardless of any access restrictions placed in <Directory> sections, the <Location> section will be evaluated last and will allow unrestricted access to the server. In other words, order of merging is important, so be careful!


However, some of the directives just have to be placed in <Location> because they need to apply to virtual URLs (for which there are no files in the filesystem) and some other ones have to apply to actual files in the filesystem, hence they have to be placed in the directory <Directory>. However, since <Location> is processed last, it seems to cancel out whatever is in <Directory> if the <Location> has to have "Allow from all" directive.

Does anyone have an idea on how to reconcile this? Is there a way to stop further processing of these rules after one has been matched in <Directory>?

Any idea or comment is greatly appreciated!

 

lucy24




msg:4535571
 1:04 am on Jan 13, 2013 (gmt 0)

Do your rules have to be inside envelopes at all?

One alternative is to use mod_rewrite with a RewriteCond looking at THE_REQUEST. The Request is whatever the user originally asked for, whether or not it "really" exists. So you can make the rule do the same job as the <Location> envelope.

But then, I'm more comfortable writing rules aimed at files that actually exist. For, ahem, a given definition of "exist".

Now, if you absolutely have to have those envelopes, you could add an environmental flag to the result of all other rules, and then start the <Location> ruleset by looking at that environment flag and letting it overrule everything else...

... or you could proceed directly to Apache 2.4, which apparently allows a generalized If/Then construction ;)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved