httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59921] New: Only the last Directory directive with same path is processed
Date Mon, 01 Aug 2016 11:44:55 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=59921

            Bug ID: 59921
           Summary: Only the last Directory directive with same path is
                    processed
           Product: Apache httpd-2
           Version: 2.4.23
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: viktor@szepe.net

Core doc says:

If multiple (non-regular expression) <Directory> sections match the directory
(or one of its parents) containing a document, then the directives are applied
in the order of shortest match first, interspersed with the directives from the
.htaccess files.

I have two Directory directives with the same path (in realty the second one is
in an Include that is used by all vhost configs)


Request URI:
http://subtwo.wp/blog/

My config:
    DocumentRoot "/var/www/subtwo/2"
    <Directory "/var/www/subtwo/2">
        # Core permalinks
        RewriteRule "^index\.php$" - [END]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule "^" "index.php" [END]
    </Directory>

    <Directory "/var/www/subtwo/2">
        RewriteRule "^blog/$" "/some-url"
    </Directory>

End up in /some-url:
init rewrite engine with requested uri /blog/
pass through /blog/
[perdir /var/www/subtwo/2/] add path info postfix: /var/www/subtwo/2/blog ->
/var/www/subtwo/2/blog/
[perdir /var/www/subtwo/2/] strip per-dir prefix: /var/www/subtwo/2/blog/ ->
blog/
[perdir /var/www/subtwo/2/] applying pattern '^blog/$' to uri 'blog/'
[perdir /var/www/subtwo/2/] rewrite 'blog/' -> '/some-url'
[perdir /var/www/subtwo/2/] trying to replace context docroot /var/www/subtwo/2
with context prefix
[perdir /var/www/subtwo/2/] internal redirect with /some-url [INTERNAL
REDIRECT]

/redir#1] init rewrite engine with requested uri /some-url
/redir#1] pass through /some-url
/redir#1] [perdir /var/www/subtwo/2/] strip per-dir prefix:
/var/www/subtwo/2/some-url -> some-url
/redir#1] [perdir /var/www/subtwo/2/] applying pattern '^blog/$' to uri
'some-url'
/redir#1] [perdir /var/www/subtwo/2/] pass through /var/www/subtwo/2/some-url


The other way around:

Config:
    DocumentRoot "/var/www/subtwo/2"
    <Directory "/var/www/subtwo/2">
        RewriteRule "^blog/$" "/some-url"
    </Directory>

    <Directory "/var/www/subtwo/2">
        # Core permalinks
        RewriteRule "^index\.php$" - [END]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule "^" "index.php" [END]
    </Directory>

Ends up in /index.php:
init rewrite engine with requested uri /blog/
pass through /blog/
[perdir /var/www/subtwo/2/] add path info postfix: /var/www/subtwo/2/blog ->
/var/www/subtwo/2/blog/
[perdir /var/www/subtwo/2/] strip per-dir prefix: /var/www/subtwo/2/blog/ ->
blog/
[perdir /var/www/subtwo/2/] applying pattern '^index\\.php$' to uri 'blog/'
[perdir /var/www/subtwo/2/] add path info postfix: /var/www/subtwo/2/blog ->
/var/www/subtwo/2/blog/
[perdir /var/www/subtwo/2/] strip per-dir prefix: /var/www/subtwo/2/blog/ ->
blog/
[perdir /var/www/subtwo/2/] applying pattern '^' to uri 'blog/'
[perdir /var/www/subtwo/2/] RewriteCond: input='/var/www/subtwo/2/blog'
pattern='!-f' => matched
[perdir /var/www/subtwo/2/] RewriteCond: input='/var/www/subtwo/2/blog'
pattern='!-d' => matched
[perdir /var/www/subtwo/2/] rewrite 'blog/' -> 'index.php'
[perdir /var/www/subtwo/2/] add per-dir prefix: index.php ->
/var/www/subtwo/2/index.php
[perdir /var/www/subtwo/2/] strip document_root prefix:
/var/www/subtwo/2/index.php -> /index.php
[perdir /var/www/subtwo/2/] internal redirect with /index.php [INTERNAL
REDIRECT]


Is this behavior just undocumented or buggy?
Thans.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message