httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r728398 - in /httpd/httpd/trunk/docs/manual/rewrite: rewrite_flags.html.en rewrite_flags.xml
Date Sun, 21 Dec 2008 08:02:32 GMT
Author: covener
Date: Sun Dec 21 00:02:32 2008
New Revision: 728398

URL: http://svn.apache.org/viewvc?rev=728398&view=rev
Log:
Clarification of regexes/examples for rewrite flags.

Submitted by: Bob Ionescu
Reviewed By: covener


Modified:
    httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.html.en
    httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.xml

Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.html.en?rev=728398&r1=728397&r2=728398&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.html.en Sun Dec 21 00:02:32 2008
@@ -83,7 +83,7 @@
 
 <div class="example"><p><code>
 RewriteEngine On<br />
-RewriteRule ^/index.html - [CO=frontdoor:yes:.apache.org:1440:/]
+RewriteRule ^/index\.html - [CO=frontdoor:yes:.apache.org:1440:/]
 </code></p></div>
 
 <p>This rule doesn't rewrite the request (the "-" rewrite target tells
@@ -161,6 +161,22 @@
 that does not contain the literal <code>.</code> character.
 </p>
 
+<p>This can be also used to force the handler based on some conditions.
+For example, the following snippet used in per-server context allows
+<code>.php</code> files to be <em>displayed</em> by <code>mod_php</code>
+if they are requested with the <code>.phps</code> extension:
+
+<div class="example"><p><code>
+RewriteRule ^(/source/.+\.php)s$ $1 [H=application/x-httpd-php-source]
+</code></p></div>
+</p>
+
+<p>The regular expression above - <code>^(/source/.+\.php)s$</code> - will
+match any request that starts with <code>/source/</code> followed by 1 or
+n characters followed by <code>.phps</code> literally. The backreference
+$1 referrers to the captured match within parenthesis of the regular
+expression.</p>
+
 
 <h3><a name="flag_l" id="flag_l">L|last</a></h3>
 <p>The [L] flag causes <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
to stop processing
@@ -192,7 +208,7 @@
 is already for <code>index.php</code>, the <code class="directive"><a
href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> will be skipped.</p>
 
 <div class="example"><p><code>
-RewriteCond %{REQUEST_URI} !index\.php<br />
+RewriteCond %{REQUEST_URI} !=index.php<br />
 RewriteRule ^(.*) index.php?req=$1 [L]
 </code></p></div>
 

Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.xml?rev=728398&r1=728397&r2=728398&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_flags.xml Sun Dec 21 00:02:32 2008
@@ -90,7 +90,7 @@
 
 <example>
 RewriteEngine On<br />
-RewriteRule ^/index.html - [CO=frontdoor:yes:.apache.org:1440:/]
+RewriteRule ^/index\.html - [CO=frontdoor:yes:.apache.org:1440:/]
 </example>
 
 <p>This rule doesn't rewrite the request (the "-" rewrite target tells
@@ -168,6 +168,22 @@
 The regular expression above - <code>!\.</code> - will match any request
 that does not contain the literal <code>.</code> character.
 </p>
+
+<p>This can be also used to force the handler based on some conditions.
+For example, the following snippet used in per-server context allows
+<code>.php</code> files to be <em>displayed</em> by <code>mod_php</code>
+if they are requested with the <code>.phps</code> extension:
+
+<example>
+RewriteRule ^(/source/.+\.php)s$ $1 [H=application/x-httpd-php-source]
+</example>
+</p>
+
+<p>The regular expression above - <code>^(/source/.+\.php)s$</code> - will
+match any request that starts with <code>/source/</code> followed by 1 or
+n characters followed by <code>.phps</code> literally. The backreference
+$1 referrers to the captured match within parenthesis of the regular
+expression.</p>
 </section>
 
 <section id="flag_l"><title>L|last</title>
@@ -204,7 +220,7 @@
 module="mod_rewrite">RewriteRule</directive> will be skipped.</p>
 
 <example>
-RewriteCond %{REQUEST_URI} !index\.php<br />
+RewriteCond %{REQUEST_URI} !=index.php<br />
 RewriteRule ^(.*) index.php?req=$1 [L]
 </example>
 </section>



Mime
View raw message