Skip to content

Commit

Permalink
Fix the -H|-h flag as spotted by Pete in the online doc.
Browse files Browse the repository at this point in the history
Add the missing -ne in RewriteCond
Add some missing hyperlinks to the corresponding directives.
(r1737767 and r1737769 in trunk)

+ synch with trunk (trailing space removal)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1737772 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Christophe Jaillet committed Apr 5, 2016
1 parent 0d3b821 commit b259ad9
Showing 1 changed file with 44 additions and 34 deletions.
78 changes: 44 additions & 34 deletions docs/manual/mod/mod_rewrite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ URLs on the fly</description>
<code>RewriteEngine on</code> directive for each virtual host
in which you wish to use rewrite rules.</p>

<p><directive>RewriteMap</directive> directives of the type <code>prg</code>
<p><directive module="mod_rewrite">RewriteMap</directive> directives
of the type <code>prg</code>
are not started during server initialization if they're defined in a
context that does not have <directive>RewriteEngine</directive> set to
context that does not have <directive>RewriteEngine</directive> set to
<code>on</code></p>
</usage>

Expand Down Expand Up @@ -206,7 +207,7 @@ URLs on the fly</description>
directory on disk but lack a trailing slash, in the expectation that
the <module>mod_dir</module> module will issue the client with a redirect to
the canonical URL with a trailing slash.</p>

<p>When the <directive module="mod_dir">DirectorySlash</directive> directive
is set to off, the <code>AllowNoSlash</code> option can be enabled to ensure
that rewrite rules are no longer ignored. This option makes it possible to
Expand Down Expand Up @@ -236,7 +237,7 @@ URLs on the fly</description>
Available in Apache HTTP Server 2.4.3 and later.</p>

<note type="warning">
<title>Security Warning</title>
<title>Security Warning</title>

<p>Enabling this option will make the server vulnerable to
security issues if used with rewrite rules which are not
Expand Down Expand Up @@ -265,8 +266,8 @@ URLs on the fly</description>
<p>When a relative substitution is made
in directory (htaccess) context and <directive module="mod_rewrite"
>RewriteBase</directive> has not been set, this module uses some
extended URL and filesystem context information to change the
relative substitution back into a URL. Modules such as
extended URL and filesystem context information to change the
relative substitution back into a URL. Modules such as
<module>mod_userdir</module> and <module>mod_alias</module>
supply this extended context info. </p>
</dd>
Expand Down Expand Up @@ -382,30 +383,31 @@ RewriteRule "^/ex/(.*)" "${examplemap:$1}"

<usage>
<p>The <directive>RewriteBase</directive> directive specifies the
URL prefix to be used for per-directory (htaccess)
<directive>RewriteRule</directive> directives that substitute a relative
path.</p>
URL prefix to be used for per-directory (htaccess)
<directive module="mod_rewrite">RewriteRule</directive> directives that
substitute a relative path.</p>
<p> This directive is <em>required</em> when you use a relative path
in a substitution in per-directory (htaccess) context unless either
of the following conditions are true:</p>
<ul>
<li> The original request, and the substitution, are underneath the
<li> The original request, and the substitution, are underneath the
<directive module="core">DocumentRoot</directive>
(as opposed to reachable by other means, such as
(as opposed to reachable by other means, such as
<directive module="mod_alias">Alias</directive>).</li>
<li> The <em>filesystem</em> path to the directory containing the
<directive>RewriteRule</directive>, suffixed by the relative
substitution is also valid as a URL path on the server
<directive module="mod_rewrite">RewriteRule</directive>,
suffixed by the relative
substitution is also valid as a URL path on the server
(this is rare).</li>
<li> In Apache HTTP Server 2.4.11 and later, this directive may be
omitted when the request is mapped via
omitted when the request is mapped via
<directive module="mod_alias">Alias</directive>
or <module>mod_userdir</module>.</li>
</ul>

<p> In the example below, <directive>RewriteBase</directive> is necessary
to avoid rewriting to http://example.com/opt/myapp-1.2.3/welcome.html
since the resource was not relative to the document root. This
since the resource was not relative to the document root. This
misconfiguration would normally cause the server to look for an "opt"
directory under the document root.</p>
<highlight language="config">
Expand Down Expand Up @@ -614,9 +616,9 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
been determined by the server at the time
<code>REQUEST_FILENAME</code> is referenced. Otherwise,
such as when used in virtual host context, the same
value as <code>REQUEST_URI</code>. Depending on the value of
value as <code>REQUEST_URI</code>. Depending on the value of
<directive module="core">AcceptPathInfo</directive>, the
server may have only used some leading components of the
server may have only used some leading components of the
<code>REQUEST_URI</code> to map the request to a file.
</dd>

Expand Down Expand Up @@ -711,7 +713,7 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
so that certain conditions might not be evaluated at all.</p></li>

<li>
<a id="LA-U" name="LA-U"><code>%{LA-U:variable}</code></a>
<a id="LA-U" name="LA-U"><code>%{LA-U:variable}</code></a>
can be used for look-aheads which perform
an internal (URL-based) sub-request to determine the final
value of <em>variable</em>. This can be used to access
Expand Down Expand Up @@ -842,6 +844,13 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
<strong>-l</strong> by using the <strong>-L</strong> or
<strong>-h</strong> variant.</dd>

<dt><strong>-ne</strong></dt>
<dd>Is numerically <strong>n</strong>ot <strong>e</strong>qual to<br />
The <em>TestString</em> is treated as an integer, and is
numerically compared to the <em>CondPattern</em>. True if
the two are numerically different. This is equivalent to
<code>!-ne</code></dd>

</dl>
</li>

Expand All @@ -851,14 +860,14 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
<dl>

<dt><strong>-d</strong></dt>

<dd>Is <strong>d</strong>irectory.<br />
Treats the <em>TestString</em> as a pathname and tests
whether or not it exists, and is a directory.
</dd>

<dt><strong>-f</strong></dt>

<dd>Is regular <strong>f</strong>ile.<br />

Treats the <em>TestString</em> as a pathname and tests
Expand All @@ -875,13 +884,13 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
it can impact your server's performance!
</dd>

<dt><strong>-H</strong></dt>
<dt><strong>-h</strong></dt>
<dd>Is symbolic link, bash convention.<br />
See <strong>-l</strong>.
</dd>

<dt><strong>-l</strong></dt>

<dd>Is symbolic <strong>l</strong>ink.<br />
Treats the <em>TestString</em> as a pathname and tests
whether or not it exists, and is a symbolic link. May also
Expand Down Expand Up @@ -910,8 +919,8 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
it can impact your server's performance!</p>
<p> This flag <em>only</em> returns information about things
like access control, authentication, and authorization. This flag
<em>does not</em> return information about the status code the
configured handler (static file, CGI, proxy, etc.) would have
<em>does not</em> return information about the status code the
configured handler (static file, CGI, proxy, etc.) would have
returned.</p> </dd>

<dt><strong>-x</strong></dt>
Expand Down Expand Up @@ -1006,7 +1015,7 @@ RewriteRule ...some special stuff for any of these hosts...
RewriteCond "%{HTTP_USER_AGENT}" "(iPhone|Blackberry|Android)"
RewriteRule "^/$" "/homepage.mobile.html" [L]

RewriteRule "^/$" "/homepage.std.html" [L]
RewriteRule "^/$" "/homepage.std.html" [L]
</highlight>

<p>Explanation: If you use a browser which identifies itself
Expand Down Expand Up @@ -1043,7 +1052,6 @@ RewriteRule "^/$" "/homepage.std.html" [L]
path relative to that per-directory context. Subsequent patterns
are matched against the output of the last matching RewriteRule.</p>


<note><title><a id="what_is_matched" name="what_is_matched">What is matched?</a></title>
<p>In <directive module="core">VirtualHost</directive> context,
The <em>Pattern</em> will initially be matched against the part of the
Expand Down Expand Up @@ -1094,7 +1102,7 @@ relative substitutions.</li>

<li> If you wish to match against the full URL-path in a per-directory
(htaccess) RewriteRule, use the <code>%{REQUEST_URI}</code> variable in
a <directive>RewriteCond</directive>.</li>
a <directive module="mod_rewrite">RewriteCond</directive>.</li>

<li>The removed prefix always ends with a slash, meaning the matching occurs against a string which
<em>never</em> has a leading slash. Therefore, a <em>Pattern</em> with <code>^/</code> never
Expand Down Expand Up @@ -1141,7 +1149,7 @@ cannot use <code>$N</code> in the substitution string!

<dd>Designates the location on the file-system of the resource
to be delivered to the client. Substitutions are only
treated as a file-system path when the rule is configured in
treated as a file-system path when the rule is configured in
server (virtualhost) context and the first component of the
path in the substitution exists in the file-system</dd>

Expand All @@ -1156,7 +1164,7 @@ cannot use <code>$N</code> in the substitution string!
you specify a <em>Substitution</em> string of
<code>/www/file.html</code>, then this will be treated as a
URL-path <em>unless</em> a directory named <code>www</code>
exists at the root or your file-system (or, in the case of
exists at the root or your file-system (or, in the case of
using rewrites in a <code>.htaccess</code> file, relative to
your document root), in which case it will
be treated as a file-system path. If you wish other
Expand Down Expand Up @@ -1205,9 +1213,11 @@ cannot use <code>$N</code> in the substitution string!
(<strong>N</strong>=0..9), 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
as for the <em>TestString</em> of a <code>RewriteCond</code>
as for the <em>TestString</em> of a
<directive module="mod_rewrite">RewriteCond</directive>
directive. The mapping-functions come from the
<code>RewriteMap</code> directive and are explained there.
<directive module="mod_rewrite">RewriteMap</directive>
directive and are explained there.
These three types of variables are expanded in the order above.</p>

<p>Rewrite rules are applied to the results of previous rewrite
Expand Down Expand Up @@ -1236,7 +1246,7 @@ cannot use <code>$N</code> in the substitution string!
<p>Additionally you can set special <a name="rewriteflags"
id="rewriteflags">actions</a> to be performed by
appending <strong><code>[</code><em>flags</em><code>]</code></strong>
as the third argument to the <code>RewriteRule</code>
as the third argument to the <directive>RewriteRule</directive>
directive. <em>Flags</em> is a comma-separated list, surround by square
brackets, of any of the flags in the following table. More
details, and examples, for each flag, are available in the <a
Expand Down Expand Up @@ -1355,7 +1365,7 @@ cannot use <code>$N</code> in the substitution string!
</tr>
<tr>
<td>qsappend|QSA</td>
<td>Appends any query string from the original request URL to
<td>Appends any query string from the original request URL to
any query string created in the rewrite target.<em><a
href="../rewrite/flags.html#flag_qsa">details ...</a></em></td>
</tr>
Expand All @@ -1368,7 +1378,7 @@ cannot use <code>$N</code> in the substitution string!
<tr>
<td>qslast|QSL</td>
<td>Interpret the last (right-most) question mark as the query string
delimeter, instead of the first (left-most) as normally used.
delimeter, instead of the first (left-most) as normally used.
Available in 2.4.19 and later.
<em><a href="../rewrite/flags.html#flag_qsl">details
...</a></em></td>
Expand Down

0 comments on commit b259ad9

Please sign in to comment.