You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2026/05/01 20:55:12 UTC
svn commit: r1933695 - httpd/httpd/trunk/docs/manual/mod
Author: rbowen
Date: Fri May 1 20:55:12 2026
New Revision: 1933695
Log:
Bug 65057: Clarify DirectoryMatch: not same as Directory, regex is substring match with no implicit anchoring, concrete trailing slash example
Modified:
httpd/httpd/trunk/docs/manual/mod/core.xml
Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml Fri May 1 20:42:25 2026 (r1933694)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Fri May 1 20:55:12 2026 (r1933695)
@@ -980,10 +980,15 @@ the contents of file-system directories
<usage>
<p><directive type="section">DirectoryMatch</directive> and
<code></DirectoryMatch></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">
<DirectoryMatch "^/www/(.+/)?[0-9]{3}/">
@@ -1004,8 +1009,9 @@ the contents of file-system directories
<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><DirectoryMatch "^/var/www/?$"></code>.
</note>
<p>From 2.4.8 onwards, named groups and backreferences are captured and