From: Rich Bowen
Date: Fri, 1 May 2026 20:55:12 +0000 (+0000)
Subject: Bug 65057: Clarify DirectoryMatch: not same as Directory, regex is substring match...
X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f8629c1ed677e18cdbf568ac29368b3e3de61ce;p=thirdparty%2Fapache%2Fhttpd.git
Bug 65057: Clarify DirectoryMatch: not same as Directory, regex is substring match with no implicit anchoring, concrete trailing slash example
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933695 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml
index 556a226671..9088e5cfe6 100644
--- a/docs/manual/mod/core.xml
+++ b/docs/manual/mod/core.xml
@@ -980,10 +980,15 @@ the contents of file-system directories matching a regular expression.
DirectoryMatch and
</DirectoryMatch> are used to enclose a group
- of directives which will apply only to the named directory (and the files within),
- the same as Directory.
- However, it takes as an argument a
- regular expression. For example:
+ of directives which will apply to directories (and the files
+ within) whose filesystem path matches the given
+ regular expression.
+ Unlike Directory,
+ it does not automatically apply to subdirectories unless the
+ pattern also matches them. It takes as an argument a
+ regular expression that is matched as a substring â it is not
+ anchored at the start or end unless you explicitly include
+ ^ or $ in the pattern. For example:
<DirectoryMatch "^/www/(.+/)?[0-9]{3}/">
@@ -1004,8 +1009,9 @@ the contents of file-system directories matching a regular expression.Trailing Slash
This directive applies to requests for directories that may or may
- not end in a trailing slash, so expressions that are anchored to the
- end of line ($) must be written with care.
+ not end in a trailing slash. If you anchor your pattern with
+ $, you may need to match both forms, e.g.,
+ <DirectoryMatch "^/var/www/?$">.
From 2.4.8 onwards, named groups and backreferences are captured and