]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
env: Document REDIRECT_URL, REDIRECT_STATUS and REDIRECT_ variable mechanism (Bug...
authorRich Bowen <rbowen@apache.org>
Wed, 29 Apr 2026 20:23:57 +0000 (20:23 +0000)
committerRich Bowen <rbowen@apache.org>
Wed, 29 Apr 2026 20:23:57 +0000 (20:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933549 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/env.xml

index a0529e7959f1d7687947af039d53f7946ba0c064..de761ba46e26e43c57e149eaa1903e28cc8a75f8 100644 (file)
 
   </section>
 
+   <section id="redirect-vars"><title>REDIRECT_ variables</title>
+
+    <p>When an internal redirect occurs — whether from an
+    <directive module="core">ErrorDocument</directive>,
+    <module>mod_rewrite</module>,
+    <directive module="mod_dir">FallbackResource</directive>, or
+    any other internal redirect mechanism — the environment
+    variables from the original request are made available to the
+    redirect target with a <code>REDIRECT_</code> prefix.</p>
+
+    <p>Two additional variables are always set:</p>
+
+    <dl>
+      <dt><code>REDIRECT_URL</code></dt>
+      <dd>The URL-path of the original request before the internal
+      redirect. This is set by the core server, not by any specific
+      module.</dd>
+
+      <dt><code>REDIRECT_STATUS</code></dt>
+      <dd>The HTTP status code that triggered the redirect. For
+      error documents this is the error status (e.g., 404). For
+      internal redirects from <module>mod_rewrite</module> or
+      <directive module="mod_dir">FallbackResource</directive>,
+      this is typically 200.</dd>
+    </dl>
+
+    <p>For example, if <code>REQUEST_URI</code> was
+    <code>/original/path</code> and an internal redirect sends the
+    request to <code>/handler.php</code>, then the redirect target
+    will see <code>REDIRECT_URL=/original/path</code> and
+    <code>REQUEST_URI=/handler.php</code>.</p>
+
+    <p>These variables are available to CGI scripts, SSI pages, and
+    in <a href="expr.html">expressions</a>. For more information
+    about REDIRECT_ variables in the context of error documents,
+    see <a href="custom-error.html">Custom Error Responses</a>.</p>
+
+   </section>
+
   <section id="examples">
     <title>Examples</title>