Skip to content

Commit 8cdb08b

Browse files
committed
Addresses bz64307 and 64607 - Correctly identifies which characters are
and are not escaped, and which behavior using NE changes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1932832 13f79535-47bb-0310-9956-ffa450edef68
1 parent 057da2d commit 8cdb08b

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

docs/manual/rewrite/flags.xml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,26 @@ RewriteRule "(.*\.(jpg|gif|png))$" "http://images.example.com$1" [P,NC]
524524
</section>
525525

526526
<section id="flag_ne"><title>NE|noescape</title>
527-
<p>By default, special characters, such as <code>&amp;</code> and
528-
<code>?</code>, for example, will be converted to their hexcode
529-
equivalent for rules that result in external redirects.
530-
Using the [NE] flag prevents that from happening.
531-
</p>
527+
<p>By default, when a <directive module="mod_rewrite">RewriteRule</directive>
528+
results in an external redirect, any characters in the output that are
529+
not in the following safe set will be converted to their hexcode
530+
(percent-encoded) equivalents:</p>
531+
532+
<ul>
533+
<li>Alphanumeric characters: <code>A-Z</code>, <code>a-z</code>,
534+
<code>0-9</code></li>
535+
<li>Special characters: <code>$-_.+!*'(),:;@&amp;=/~</code></li>
536+
</ul>
537+
538+
<p>For example, <code>#</code> would be converted to <code>%23</code>,
539+
and <code>?</code> to <code>%3F</code>. The <code>%</code> character
540+
is also escaped (to <code>%25</code>), which means that any
541+
percent-encoding already present in the substitution will be
542+
double-encoded.</p>
543+
544+
<p>Using the [NE] flag prevents this escaping, allowing characters
545+
such as <code>#</code> and <code>?</code> to pass through to the
546+
redirect URL unmodified.</p>
532547

533548
<highlight language="config">
534549
RewriteRule "^/anchor/(.+)" "/bigpage.html#$1" [NE,R]

0 commit comments

Comments
 (0)