]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Bug 65057: Clarify DirectoryMatch: not same as Directory, regex is substring match...
authorRich Bowen <rbowen@apache.org>
Fri, 1 May 2026 20:55:12 +0000 (20:55 +0000)
committerRich Bowen <rbowen@apache.org>
Fri, 1 May 2026 20:55:12 +0000 (20:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933695 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/core.xml

index 556a2266714c63810448b393fa64835e8db8706e..9088e5cfe6d785e546174b1978481a3de22176ae 100644 (file)
@@ -980,10 +980,15 @@ the contents of file-system directories matching a regular expression.</descript
 <usage>
     <p><directive type="section">DirectoryMatch</directive> and
     <code>&lt;/DirectoryMatch&gt;</code> are used to enclose a group
-    of directives which will apply only to the named directory (and the files within),
-    the same as <directive module="core" type="section">Directory</directive>.
-    However, it takes as an argument a
-    <glossary ref="regex">regular expression</glossary>.  For example:</p>
+    of directives which will apply to directories (and the files
+    within) whose filesystem path matches the given
+    <glossary ref="regex">regular expression</glossary>.
+    Unlike <directive module="core" type="section">Directory</directive>,
+    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
+    <code>^</code> or <code>$</code> in the pattern.  For example:</p>
 
     <highlight language="config">
 &lt;DirectoryMatch "^/www/(.+/)?[0-9]{3}/"&gt;
@@ -1004,8 +1009,9 @@ the contents of file-system directories matching a regular expression.</descript
 
     <note><title>Trailing Slash</title>
       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
+      <code>$</code>, you may need to match both forms, e.g.,
+      <code>&lt;DirectoryMatch "^/var/www/?$"&gt;</code>.
     </note>
 
     <p>From 2.4.8 onwards, named groups and backreferences are captured and