]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Consolidate "What is matched?" from mod_rewrite.xml into rewrite/intro.xml
authorRich Bowen <rbowen@apache.org>
Fri, 15 May 2026 16:42:03 +0000 (16:42 +0000)
committerRich Bowen <rbowen@apache.org>
Fri, 15 May 2026 16:42:03 +0000 (16:42 +0000)
Replace the detailed "What is matched?" note block in mod_rewrite.xml
with a concise summary linking to rewrite/intro.html#rewriterule.

Expand the RewriteRule Basics section in rewrite/intro.xml to cover:
- Pattern matches %-decoded URL-path (server context)
- Pattern matches directory-relative path (per-directory context),
  with link to htaccess.html#path-stripping
- Pattern does NOT match hostname, port, or query string —
  use RewriteCond with %{HTTP_HOST}, %{SERVER_PORT}, %{QUERY_STRING}

Part of: https://bz.apache.org/bugzilla/show_bug.cgi?id=70045

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934230 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_rewrite.xml
docs/manual/rewrite/intro.xml

index bbe6d5b8098baf2da76918a5e1f7bcaa35acc9f0..0a1051f89cf1d0f1d154031c5197c6c4a83ca2be 100644 (file)
@@ -1099,37 +1099,14 @@ RewriteRule  "^/$"                 "/homepage.std.html"     [L]
 
 <note><title><a id="what_is_matched" name="what_is_matched">What is matched?</a></title>
 
-<ul>
-      <li><p>In <directive module="core">VirtualHost</directive> context,
-      The <em>Pattern</em> will initially be matched against the part of the
-      URL after the hostname and port, and before the query string (e.g. "/app1/index.html").
-      This is the (%-decoded) <a href="directive-dict.html#Syntax">URL-path</a>.</p></li>
-
-      <li><p>In <glossary ref="perdirectory">per-directory context</glossary>
-      (<directive module="core">Directory</directive> and .htaccess),
-      the <em>Pattern</em> is matched against only a partial path, for example a request
-      of "/app1/index.html" may result in comparison against "app1/index.html" 
-      or "index.html" depending on the directory-path for which the
-      <directive>RewriteRule</directive> applies.</p>
-
-      <p>The directory-path to which the rule applies is stripped from the currently mapped
-      filesystem path before comparison (up to and including a trailing slash). 
-      The net result of this <glossary ref="perdirectory">per-directory</glossary> prefix stripping is that rules in
-      this context only match against the portion of the currently mapped filesystem path 
-      "below" the directory-path to which the rule applies.</p>
-
-      <p>Directives such as <directive module="core"
-      >DocumentRoot</directive> and <directive module="mod_alias">Alias</directive>, or even the 
-      result of previous <directive>RewriteRule</directive> substitutions, determine
-      the currently mapped filesystem path.  
-      </p>
-      </li>
-
-      <li><p>If you wish to match against the hostname, port, or query string, use a
-      <directive module="mod_rewrite">RewriteCond</directive> with the
-      <code>%{HTTP_HOST}</code>, <code>%{SERVER_PORT}</code>, or
-      <code>%{QUERY_STRING}</code> variables respectively.</p></li>
-</ul>
+<p>
+The <em>Pattern</em> is matched against the %-decoded URL-path
+(in server context) or the directory-relative path (in
+<glossary ref="perdirectory">per-directory context</glossary>).
+See <a href="../rewrite/intro.html#rewriterule">RewriteRule
+Basics</a> for details on what the pattern is matched against
+in each context.
+</p>
 </note>
 
 <note><title><glossary ref="perdirectory">Per-directory</glossary> Rewrites</title>
index 9132a53ca949e915f53a5e791315a231ba2fb9fb..afd053993c64f08160b5ef8457f101c666b2c9ee 100644 (file)
@@ -230,15 +230,27 @@ of three arguments separated by spaces. The arguments are</p>
 </ol>
 
 <p>The <var>Pattern</var> is a <a href="#regex">regular expression</a>.
-It is initially (for the first rewrite rule or until a substitution occurs)
-matched against the URL-path of the incoming request (the part after the
-hostname but before any question mark indicating the beginning of a query
-string) or, in per-directory context, against the request's path relative
-to the directory for which the rule is defined. Once a substitution has
-occurred, the rules that follow are matched against the substituted
-value.
+In server or virtualhost context, it is matched against the
+%-decoded <a href="../directive-dict.html#Syntax">URL-path</a>
+of the incoming request &mdash; the part after the hostname and port,
+and not including the query string (e.g., <code>/app/index.html</code>).
+In <glossary ref="perdirectory">per-directory context</glossary>,
+the pattern is matched against the request's path relative to the
+directory for which the rule is defined (with the directory prefix
+stripped &mdash; see <a href="htaccess.html#path-stripping">Per-directory
+Rewrites</a> for details).
 </p>
 
+<p>Once a substitution has occurred, any rules that follow are
+matched against the substituted value.</p>
+
+<p>The <var>Pattern</var> is matched only against the URL-path
+&mdash; not the hostname, port, or query string. To match against
+those, use a
+<directive module="mod_rewrite">RewriteCond</directive> with the
+<code>%{HTTP_HOST}</code>, <code>%{SERVER_PORT}</code>, or
+<code>%{QUERY_STRING}</code> variables respectively.</p>
+
 <p class="figure">
       <img src="../images/syntax_rewriterule.png"
       alt="Syntax of the RewriteRule directive" /><br />