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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]