You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by pa...@apache.org on 2002/03/12 16:22:45 UTC
cvs commit: httpd-2.0/docs/manual/mod mod_rewrite.xml
patrikj 02/03/12 07:22:45
Modified: docs/manual/mod mod_rewrite.xml
Log:
Edited so that it can be validated.
Revision Changes Path
1.2 +59 -89 httpd-2.0/docs/manual/mod/mod_rewrite.xml
Index: mod_rewrite.xml
===================================================================
RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_rewrite.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mod_rewrite.xml 15 Feb 2002 18:02:19 -0000 1.1
+++ mod_rewrite.xml 12 Mar 2002 15:22:45 -0000 1.2
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!DOCTYPE xml:manual [ <!ENTITY nbsp " "> ]>
+<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.xsl"?>
<modulesynopsis>
@@ -18,24 +18,21 @@
<em>``The great thing about mod_rewrite is it gives you
all the configurability and flexibility of Sendmail.
The downside to mod_rewrite is that it gives you all
- the configurability and flexibility of Sendmail.''</em>
-
+ the configurability and flexibility of Sendmail.''</em><br />
+
+ -- Brian Behlendorf<br />
+ Apache Group
- <div align="RIGHT">
- -- Brian Behlendorf<br />
- Apache Group
- </div>
</blockquote>
<blockquote>
<em>`` Despite the tons of examples and docs,
mod_rewrite is voodoo. Damned cool voodoo, but still
- voodoo. ''</em>
+ voodoo. ''</em> <br />
+
+ -- Brian Moore<br />
+ bem@news.cmc.net
- <div align="RIGHT">
- -- Brian Moore<br />
- bem@news.cmc.net
- </div>
</blockquote>
@@ -178,23 +175,11 @@
directives). For historical reasons the conditions are given
first, and so the control flow is a little bit long-winded. See
Figure 1 for more details.</p>
-
- <div align="CENTER">
- <table cellspacing="0" cellpadding="2" border="0">
- <tr>
- <td bgcolor="#CCCCCC"><img
- src="../images/mod_rewrite_fig1.gif" width="428"
- height="385"
- alt="[Needs graphics capability to display]" /></td>
- </tr>
-
- <tr>
- <td align="CENTER"><strong>Figure 1:</strong> The
- control flow through the rewriting ruleset</td>
- </tr>
- </table>
- </div>
-
+<section>
+ <img src="../images/mod_rewrite_fig1.gif" border="1" width="428"
+ height="385" alt="[Needs graphics capability to display]" />
+ <p><strong>Figure 1:</strong>The control flow through the rewriting ruleset</p>
+</section>
<p>As you can see, first the URL is matched against the
<em>Pattern</em> of each rule. When it fails mod_rewrite
immediately stops processing this rule and continues with the
@@ -221,11 +206,11 @@
<section id="quoting"><title>Quoting Special Characters</title>
<p>As of Apache 1.3.20, special characters in
- <i>TestString</i> and <i>Substitution</i> strings can be
+ <em>TestString</em> and <em>Substitution</em> strings can be
escaped (that is, treated as normal characters without their
usual special meaning) by prefixing them with a slosh ('\')
character. In other words, you can include an actual
- dollar-sign character in a <i>Substitution</i> string by
+ dollar-sign character in a <em>Substitution</em> string by
using '<code>\$</code>'; this keeps mod_rewrite from trying
to treat it as a backreference.</p>
</section>
@@ -241,22 +226,11 @@
Figure 2 shows to which locations the back-references are
transfered for expansion.</p>
- <div align="CENTER">
- <table cellspacing="0" cellpadding="2" border="0">
- <tr>
- <td bgcolor="#CCCCCC"><img
- src="../images/mod_rewrite_fig2.gif" width="381"
- height="179"
- alt="[Needs graphics capability to display]" /></td>
- </tr>
-
- <tr>
- <td align="CENTER"><strong>Figure 2:</strong> The
- back-reference flow through a rule</td>
- </tr>
- </table>
- </div>
-
+<section>
+ <img src="../images/mod_rewrite_fig2.gif" border="1" width="381"
+ height="179" alt="[Needs graphics capability to display]" />
+ <p><strong>Figure 2:</strong> The back-reference flow through a rule.</p>
+</section>
<p>We know this was a crash course on mod_rewrite's internal
processing. But you will benefit from this knowledge when
reading the following documentation of the available
@@ -305,11 +279,8 @@
<directivesynopsis>
-
<name>RewriteEngine</name>
-
-<summary>Enables or disables runtime rewriting engine</summary>
-
+<description>Enables or disables runtime rewriting engine</description>
<syntax>RewriteEngine on|off</syntax>
<default>RewriteEngine off</default>
<contextlist><context>server config</context><context>virtual host</context>
@@ -391,7 +362,7 @@
directive or use <code>RewriteLogLevel 0</code>!
</note>
-<note><title>Security</title>
+<note type="securitywarning"><title>Security</title>
See the <a href="../misc/security_tips.html">Apache Security Tips</a>
document for details on why your security could be compromised if the
@@ -688,12 +659,12 @@
</ol>
</li>
</ul>
- The <directive>RewriteMap</directive> directive can occur more than
+ <p>The <directive>RewriteMap</directive> directive can occur more than
once. For each mapping-function use one
<directive>RewriteMap</directive> directive to declare its rewriting
mapfile. While you cannot <strong>declare</strong> a map in
per-directory context it is of course possible to
- <strong>use</strong> this map in per-directory context.
+ <strong>use</strong> this map in per-directory context. </p>
<note><title>Note</title> For plain text and DBM format files the
looked-up keys are cached in-core until the <code>mtime</code> of the
@@ -710,7 +681,7 @@
<name>RewriteBase</name>
<description>Sets the base URL for per-directory rewrites</description>
<syntax>RewriteBase <em>URL-path</em></syntax>
-<default>RewriteBase <em>physical-directory-path</em></default>
+<default>See usage for information.</default>
<contextlist><context>directory</context><context>.htaccess</context>
</contextlist>
<override>FileInfo</override>
@@ -724,7 +695,7 @@
<em>i.e.</em>, the local directory prefix is stripped at this
stage of processing and your rewriting rules act only on the
remainder. At the end it is automatically added back to the
- path.</p>
+ path. The default setting is; <directive>RewriteBase</directive> <em>physical-directory-path</em></p>
<p>When a substitution occurs for a new URL, this module has
to re-inject the URL into the server processing. To be able
@@ -772,7 +743,7 @@
<p>The following list gives detailed information about
the internal processing steps:</p>
<pre>
-<font size="-1">Request:
+Request:
/xyz/oldstuff.html
Internal Processing:
@@ -783,9 +754,8 @@
Result:
/abc/def/newstuff.html
-</font>
</pre>
- <p><font size="-1">This seems very complicated but is
+ <p>This seems very complicated but is
the correct Apache internal processing, because the
per-directory rewriting comes too late in the
process. So, when it occurs the (rewritten) request
@@ -795,7 +765,7 @@
internally to the Apache server and the same
procedure is used by many other operations inside
Apache. So, you can be sure the design and
- implementation is correct.</font></p>
+ implementation is correct.</p>
</note>
</usage>
@@ -877,23 +847,23 @@
<table bgcolor="#F0F0F0" cellspacing="0" cellpadding="5">
<tr>
- <td valign="TOP">
+ <td>
<strong>HTTP headers:</strong>
- <p><font size="-1">HTTP_USER_AGENT<br />
+ <p>HTTP_USER_AGENT<br />
HTTP_REFERER<br />
HTTP_COOKIE<br />
HTTP_FORWARDED<br />
HTTP_HOST<br />
HTTP_PROXY_CONNECTION<br />
HTTP_ACCEPT<br />
- </font></p>
+ </p>
</td>
- <td valign="TOP">
+ <td>
<strong>connection & request:</strong>
- <p><font size="-1">REMOTE_ADDR<br />
+ <p>REMOTE_ADDR<br />
REMOTE_HOST<br />
REMOTE_USER<br />
REMOTE_IDENT<br />
@@ -902,28 +872,28 @@
PATH_INFO<br />
QUERY_STRING<br />
AUTH_TYPE<br />
- </font></p>
+ </p>
</td>
</tr>
<tr>
- <td valign="TOP">
+ <td>
<strong>server internals:</strong>
- <p><font size="-1">DOCUMENT_ROOT<br />
+ <p>DOCUMENT_ROOT<br />
SERVER_ADMIN<br />
SERVER_NAME<br />
SERVER_ADDR<br />
SERVER_PORT<br />
SERVER_PROTOCOL<br />
SERVER_SOFTWARE<br />
- </font></p>
+ </p>
</td>
- <td valign="TOP">
+ <td>
<strong>system stuff:</strong>
- <p><font size="-1">TIME_YEAR<br />
+ <p>TIME_YEAR<br />
TIME_MON<br />
TIME_DAY<br />
TIME_HOUR<br />
@@ -931,18 +901,18 @@
TIME_SEC<br />
TIME_WDAY<br />
TIME<br />
- </font></p>
+ </p>
</td>
- <td valign="TOP">
+ <td>
<strong>specials:</strong>
- <p><font size="-1">API_VERSION<br />
+ <p>API_VERSION<br />
THE_REQUEST<br />
REQUEST_URI<br />
REQUEST_FILENAME<br />
IS_SUBREQ<br />
- </font></p>
+ </p>
</td>
</tr>
</table>
@@ -1091,7 +1061,7 @@
<em>TestString</em> is lexically equal to
<em>CondPattern</em>, i.e the two strings are exactly
equal (character by character). If <em>CondPattern</em>
- is just <samp>""</samp> (two quotation marks) this
+ is just <code>""</code> (two quotation marks) this
compares <em>TestString</em> to the empty string.</li>
<li>'<strong>-d</strong>' (is
@@ -1146,9 +1116,10 @@
<blockquote>
<strong><code>[</code><em>flags</em><code>]</code></strong>
</blockquote>
- as the third argument to the <code>RewriteCond</code>
+
+ <p>as the third argument to the <code>RewriteCond</code>
directive. <em>Flags</em> is a comma-separated list of the
- following flags:
+ following flags:</p>
<ul>
<li>'<strong><code>nocase|NC</code></strong>'
@@ -1241,7 +1212,7 @@
<table bgcolor="#F0F0F0" cellspacing="0" cellpadding="5">
<tr>
- <td valign="TOP">
+ <td>
<pre>
<strong>Text:</strong>
<strong><code>.</code></strong> Any single character
@@ -1324,7 +1295,7 @@
<li><a href="#mapfunc">mapping-function</a> calls
(<code>${mapname:key|default}</code>)</li>
</ol>
- Back-references are <code>$</code><strong>N</strong>
+ <p>Back-references are <code>$</code><strong>N</strong>
(<strong>N</strong>=0..9) identifiers which will be replaced
by the contents of the <strong>N</strong>th group of the
matched <em>Pattern</em>. The server-variables are the same
@@ -1332,7 +1303,7 @@
directive. The mapping-functions come from the
<code>RewriteMap</code> directive and are explained there.
These three types of variables are expanded in the order of
- the above list.
+ the above list. </p>
<p>As already mentioned above, all the rewriting rules are
applied to the <em>Substitution</em> (in the order of
@@ -1385,9 +1356,10 @@
<blockquote>
<strong><code>[</code><em>flags</em><code>]</code></strong>
</blockquote>
+ <p>
as the third argument to the <code>RewriteRule</code>
directive. <em>Flags</em> is a comma-separated list of the
- following flags:
+ following flags: </p>
<ul>
<li>
@@ -1771,7 +1743,8 @@
<code>/</code> <em>Language</em> <code>/~</code>
<em>Realname</em> <code>/.../</code> <em>File</em>
</blockquote>
- into
+
+ <p>into </p>
<blockquote>
<code>/u/</code> <em>Username</em> <code>/.../</code>
@@ -1789,10 +1762,7 @@
RewriteMap real-to-user txt:/path/to/file/map.txt
RewriteRule ^/([^/]+)/~([^/]+)/(.*)$ /u/${real-to-user:$2|nobody}/$3.$1
</pre>
-</example>
-
-</usage>
-</directivesynopsis>
-
+ </example>
+ </usage>
+ </directivesynopsis>
</modulesynopsis>
-