You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Matt McCutchen <ma...@mattmccutchen.net> on 2009/02/02 03:36:53 UTC

Re: [users@httpd] Semantics of "RewriteOptions inherit" in htaccess files needs improvement

On Sun, 2009-02-01 at 23:19 +0100, Bob Ionescu wrote:
> 2009/1/31 Matt McCutchen <ma...@mattmccutchen.net>:
> > #1. Currently, "RewriteOptions inherit" works as if the parent's rules
> > were copied and pasted into the child (after any other rules).  This
> > means that requests in the child directory are tested against the
> > parent's rules after stripping the /child's/ RewriteBase.  Thus, the
> > parent's rules have a different effect when inherited by "RewriteOptions
> > inherit" compared to when the child has no mod_rewrite configuration at
> > all, in which case they are tested after stripping the /parent's/
> > RewriteBase.  I found this behavior surprising.

[Note: I guess everywhere I said RewriteBase, I really meant per-dir
prefix.  The per-dir prefix is what is stripped at the beginning; the
RewriteBase is prepended at the end.]

> Mhmmm; actually, that's exactly what I'm using in environments where I
> don't have access to the main server configuration. :-)
> E.g. domain1 points to /var/www, domain2 to /var/www/sub and
> /var/www/sub/.htaccess inherits (i.e. 1:1 copy) /var/www/.htaccess. A
> regEx of ^foo$ in /var/www/sub/.htaccess would match against a

I think you meant /var/www/.htaccess in that line.

> filename /var/www/foo and against /var/www/sub/foo in
> /var/www/sub/.htaccess caused by inheriting, which is intended (the
> per-dir prefix is striped prior matching, of course). The URL-path
> (which doesn't matter in per-dir context for matching) would be in
> both cases /foo while the domain is different.

Really?  I straced Apache 2.2.10 and it only starts processing .htaccess
files from the document root, so if the document root for domain2
were /var/www/sub , it would not read /var/www/.htaccess at all to
inherit any rules defined there.  Is your Apache behaving differently?

-- 
Matt


---------------------------------------------------------------------
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


Re: [users@httpd] Semantics of "RewriteOptions inherit" in htaccess files needs improvement

Posted by Matt McCutchen <ma...@mattmccutchen.net>.
On Mon, 2009-02-02 at 21:00 +0100, Bob Ionescu wrote:
> 2009/2/2 Matt McCutchen <ma...@mattmccutchen.net>:
> > On Sun, 2009-02-01 at 23:19 +0100, Bob Ionescu wrote:
> >> E.g. domain1 points to /var/www, domain2 to /var/www/sub and
> >> /var/www/sub/.htaccess inherits (i.e. 1:1 copy) /var/www/.htaccess. A
> >> regEx of ^foo$ in /var/www/sub/.htaccess would match against a
> >
> > I think you meant /var/www/.htaccess in that line.
> 
> Yes, sorry.
> 
> >> filename /var/www/foo and against /var/www/sub/foo in
> >> /var/www/sub/.htaccess caused by inheriting, which is intended (the
> >> per-dir prefix is striped prior matching, of course). The URL-path
> >> (which doesn't matter in per-dir context for matching) would be in
> >> both cases /foo while the domain is different.
> >
> > Really?  I straced Apache 2.2.10 and it only starts processing .htaccess
> > files from the document root, so if the document root for domain2
> > were /var/www/sub , it would not read /var/www/.htaccess at all to
> > inherit any rules defined there.  Is your Apache behaving differently?
> 
> May be a matter of AllowOverride? DocumentRoot and the configured path
> for <directory> settings are not necessarily the same; if you
> configure document root /var/www/sub to have AllowOverride FileInfo
> for <Directoty /var/www>, mod_rewrite should process the rules.

You are right.  When I enabled AllowOverride on /, Apache did try to
read all the htaccess files.

-- 
Matt


---------------------------------------------------------------------
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


Re: [users@httpd] Semantics of "RewriteOptions inherit" in htaccess files needs improvement

Posted by Bob Ionescu <bo...@googlemail.com>.
2009/2/2 Matt McCutchen <ma...@mattmccutchen.net>:
> On Sun, 2009-02-01 at 23:19 +0100, Bob Ionescu wrote:
>> E.g. domain1 points to /var/www, domain2 to /var/www/sub and
>> /var/www/sub/.htaccess inherits (i.e. 1:1 copy) /var/www/.htaccess. A
>> regEx of ^foo$ in /var/www/sub/.htaccess would match against a
>
> I think you meant /var/www/.htaccess in that line.

Yes, sorry.

>> filename /var/www/foo and against /var/www/sub/foo in
>> /var/www/sub/.htaccess caused by inheriting, which is intended (the
>> per-dir prefix is striped prior matching, of course). The URL-path
>> (which doesn't matter in per-dir context for matching) would be in
>> both cases /foo while the domain is different.
>
> Really?  I straced Apache 2.2.10 and it only starts processing .htaccess
> files from the document root, so if the document root for domain2
> were /var/www/sub , it would not read /var/www/.htaccess at all to
> inherit any rules defined there.  Is your Apache behaving differently?

May be a matter of AllowOverride? DocumentRoot and the configured path
for <directory> settings are not necessarily the same; if you
configure document root /var/www/sub to have AllowOverride FileInfo
for <Directoty /var/www>, mod_rewrite should process the rules.
But that was just an example.

Bob

---------------------------------------------------------------------
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