You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sl...@apache.org on 2008/03/12 16:54:12 UTC

svn commit: r636379 - /httpd/httpd/branches/2.2.x/docs/manual/rewrite/

Author: slive
Date: Wed Mar 12 08:53:58 2008
New Revision: 636379

URL: http://svn.apache.org/viewvc?rev=636379&view=rev
Log:
Push the trunk version of manual/rewrite/ back to 2.2 as of
r636374.

This includes added the flags document plus a few other little changes
that never got back-ported.

Added:
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html.en
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml.meta
Modified:
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.html.en
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.xml
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.html.en
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.xml
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.html.en
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.xml
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.html.en
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.xml

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.html.en?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.html.en (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.html.en Wed Mar 12 08:53:58 2008
@@ -33,7 +33,7 @@
       </blockquote>
 
       <blockquote>
-            <p>`` Despite the tons of examples and docs,
+            <p>``Despite the tons of examples and docs,
             mod_rewrite is voodoo. Damned cool voodoo, but still
             voodoo.''</p>
 
@@ -59,7 +59,8 @@
       <p>This module operates on the full URLs (including the
       path-info part) both in per-server context
       (<code>httpd.conf</code>) and per-directory context
-      (<code>.htaccess</code>) and can even generate query-string
+      (<code>.htaccess</code> files and <code>&lt;Directory&gt;</code>
+      blocks) and can even generate query-string
       parts on result. The rewritten result can lead to internal
       sub-processing, external request redirection or even to an
       internal proxy throughput.</p>
@@ -69,10 +70,8 @@
       entire module in just one day.</p>
 
 </div>
-<div id="quickview"><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">mod_rewrite reference
-documentation</a></li><li><a href="rewrite_intro.html">Introduction</a></li><li><a href="rewrite_tech.html">Technical details</a></li><li><a href="rewrite_guide.html">Practical solutions to common
-problems</a></li><li><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></li></ul></div>
+<div id="quickview"><h3>See also</h3><ul class="seealso"><li><a href="../urlmapping.html">Mapping URLs to the Filesystem</a></li><li><a href="http://wiki.apache.org/httpd/Rewrite">mod_rewrite
+wiki</a></li><li><a href="../glossary.html">Glossary</a></li></ul></div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="documentation" id="documentation">Documentation</a></h2>
@@ -80,12 +79,11 @@
 <li><a href="../mod/mod_rewrite.html">mod_rewrite reference
 documentation</a></li>
 <li><a href="rewrite_intro.html">Introduction</a></li>
+<li><a href="rewrite_flags.html">Flags</a></li>
 <li><a href="rewrite_tech.html">Technical details</a></li>
-<li><a href="rewrite_guide.html">Practical solutions to common
-problems</a></li>
-<li><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></li>
-<li><a href="../glossary.html">Glossary</a></li>
+<li><a href="rewrite_guide.html">Rewrite Guide - useful examples</a></li>
+<li><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide - more
+useful examples</a></li>
 </ul>
 </div></div>
 <div class="bottomlang">

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.xml?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/index.xml Wed Mar 12 08:53:58 2008
@@ -38,7 +38,7 @@
       </blockquote>
 
       <blockquote>
-            <p>`` Despite the tons of examples and docs,
+            <p>``Despite the tons of examples and docs,
             mod_rewrite is voodoo. Damned cool voodoo, but still
             voodoo.''</p>
 
@@ -64,7 +64,8 @@
       <p>This module operates on the full URLs (including the
       path-info part) both in per-server context
       (<code>httpd.conf</code>) and per-directory context
-      (<code>.htaccess</code>) and can even generate query-string
+      (<code>.htaccess</code> files and <code>&lt;Directory&gt;</code>
+      blocks) and can even generate query-string
       parts on result. The rewritten result can lead to internal
       sub-processing, external request redirection or even to an
       internal proxy throughput.</p>
@@ -75,26 +76,21 @@
 
 </summary>
 
-<seealso><a href="../mod/mod_rewrite.html">mod_rewrite reference
-documentation</a></seealso>
-<seealso><a href="rewrite_intro.html">Introduction</a></seealso>
-<seealso><a href="rewrite_tech.html">Technical details</a></seealso>
-<seealso><a href="rewrite_guide.html">Practical solutions to common
-problems</a></seealso>
-<seealso><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></seealso>
+<seealso><a href="../urlmapping.html">Mapping URLs to the Filesystem</a></seealso>
+<seealso><a href="http://wiki.apache.org/httpd/Rewrite">mod_rewrite
+wiki</a></seealso>
+<seealso><a href="../glossary.html">Glossary</a></seealso>
 
 <section id="documentation"><title>Documentation</title>
 <ul>
 <li><a href="../mod/mod_rewrite.html">mod_rewrite reference
 documentation</a></li>
 <li><a href="rewrite_intro.html">Introduction</a></li>
+<li><a href="rewrite_flags.html">Flags</a></li>
 <li><a href="rewrite_tech.html">Technical details</a></li>
-<li><a href="rewrite_guide.html">Practical solutions to common
-problems</a></li>
-<li><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></li>
-<li><a href="../glossary.html">Glossary</a></li>
+<li><a href="rewrite_guide.html">Rewrite Guide - useful examples</a></li>
+<li><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide - more
+useful examples</a></li>
 </ul>
 </section>
 

Added: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html?rev=636379&view=auto
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html (added)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html Wed Mar 12 08:53:58 2008
@@ -0,0 +1,3 @@
+URI: rewrite_flags.html.en
+Content-Language: en
+Content-type: text/html; charset=ISO-8859-1

Added: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html.en?rev=636379&view=auto
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html.en (added)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.html.en Wed Mar 12 08:53:58 2008
@@ -0,0 +1,420 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
+        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+              This file is generated from xml source: DO NOT EDIT
+        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+      -->
+<title>Apache mod_rewrite Flags - Apache HTTP Server</title>
+<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
+<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
+<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
+<link href="/images/favicon.ico" rel="shortcut icon" /></head>
+<body id="manual-page"><div id="page-header">
+<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
+<p class="apache">Apache HTTP Server Version 2.2</p>
+<img alt="" src="/images/feather.gif" /></div>
+<div class="up"><a href="./index.html"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
+<div id="path">
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="/">Version 2.2</a></div><div id="page-content"><div id="preamble"><h1>Apache mod_rewrite Flags</h1>
+<div class="toplang">
+<p><span>Available Languages: </span></p>
+</div>
+
+<p>This document discusses the flags which are available to the
+<code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive,
+providing detailed explanations and examples. This is not necessarily
+a comprehensive list of all flags available, so be sure to also
+consult the reference documentation.</p>
+</div>
+<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#introduction">Introduction</a></li>
+<li><img alt="" src="/images/down.gif" /> <a href="#flags">The flags</a></li>
+</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="rewrite_tech.html">Technical details</a></li><li><a href="rewrite_guide.html">Rewrite Guide - useful examples</a></li><li><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide -
+advanced useful examples</a></li></ul></div>
+<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="introduction" id="introduction">Introduction</a></h2>
+<p><code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>s can have
+their behavior modified by one or more flags. Flags are included in
+square brackets at the end of the rule, and multiple flags are separated
+by commas.</p>
+<div class="example"><p><code>
+RewriteRule pattern target [Flag1,Flag2,Flag3]
+</code></p></div>
+
+<p>The flags all have a short form, such as <code>CO</code>, as well as
+a longer form, such as <code>cookie</code>. Some flags take one or more
+arguments. Flags are not case sensitive.</p>
+
+</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="flags" id="flags">The flags</a></h2>
+
+<p>Each flag has a long and short form. While it is most common to use
+the short form, it is recommended that you familiarize yourself with the
+long form, so that you remember what each flag is supposed to do.</p>
+
+<p>Presented here are each of the available flags, along with an example
+of how you might use them.</p>
+
+<h3><a name="flag_c" id="flag_c">C|chain</a></h3>
+<p>The [C] or [chain] flag indicates that the <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> is chained to the next
+rule. That is, if the rule matches, then it is processed as usual and
+control moves on to the next rule. However, if it does not match, then
+the next rule, and any other rules that are chained together, will be
+skipped.</p>
+
+
+
+<h3><a name="flag_co" id="flag_co">CO|cookie</a></h3>
+<p>The [CO], or [cookie] flag, allows you to set a cookie when a
+particular <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>
+matches. The argument consists of three required fields and two optional
+fields.</p>
+<p>You must declare a name and value for the cookie to be set, and the
+domain for which you wish the cookie to be valid. You may optionally set
+the lifetime of the cookie, and the path for which it should be
+returned.</p>
+<p>By default, the lifetime of the cookie is the current browser
+session.</p>
+<p>By default, the path for which the cookie will be valid is "/" - that
+is, the entire website.</p>
+<p>Several examples are offered here:</p>
+
+<div class="example"><p><code>
+RewriteEngine On<br />
+RewriteRule ^/index.html - [CO=frontdoor:yes:.apache.org:1440:/]
+</code></p></div>
+
+<p>This rule doesn't rewrite the request (the "-" rewrite target tells
+mod_rewrite to pass the request through unchanged) but sets a cookie
+called 'frontdoor' to a value of 'yes'. The cookie is valid for any host
+in the <code>.apache.org</code> domain. It will be set to expire in 1440
+minutes (24 hours) and will be returned for all URIs.</p>
+
+
+
+<h3><a name="flag_e" id="flag_e">E|env</a></h3>
+<p>With the [E], or [env] flag, you can set the value of an environment
+variable. Note that some environment variables may be set after the rule
+is run, thus unsetting what you have set. See <a href="../env.html">the
+Environment Variables document</a> for more details on how Environment
+variables work.</p>
+
+<p>The following example sets an evironment variable called 'image' to a
+value of '1' if the requested URI is an image file. Then, that
+environment variable is used to exclude those requests from the access
+log.</p>
+
+<div class="example"><p><code>
+RewriteRule \.(png|gif|jpg) - [E=image:1]<br />
+CustomLog logs/access_log combined env=!image
+</code></p></div>
+
+<p>Note that this same effect can be obtained using <code class="directive"><a href="/mod/mod_setenvif.html#setenvif">SetEnvIf</a></code>. This technique is offered as
+an example, not as a recommendation.</p>
+
+
+<h3><a name="flag_f" id="flag_f">F|forbidden</a></h3>
+<p>Using the [F] flag causes Apache to return a 403 Forbidden status
+code to the client. While the same behavior can be accomplished using
+the <code class="directive"><a href="/mod/mod_access.html#deny">Deny</a></code> directive, this 
+allows more flexibility in assigning a Forbidden status.</p>
+
+<p>The following rule will forbid <code>.exe</code> files from being
+downloaded from your server.</p>
+
+<div class="example"><p><code>
+RewriteRule \.exe - [F]
+</code></p></div>
+
+<p>This example uses the "-" syntax for the rewrite target, which means
+that the requested URI is not modified. There's no reason to rewrite to
+another URI, if you're going to forbid the request.</p>
+
+
+
+<h3><a name="flag_g" id="flag_g">G|gone</a></h3>
+<p>The [G] flag forces Apache to return a 410 Gone status with the
+response. This indicates that a resource used to be available, but is no
+longer available.</p>
+
+<p>As with the [F] flag, you will typically use the "-" syntax for the
+rewrite target when using the [G] flag:</p>
+
+<div class="example"><p><code>
+RewriteRule oldproduct - [G,NC]
+</code></p></div>
+
+
+<h3><a name="flag_h" id="flag_h">H|handler</a></h3>
+<p>Forces the resulting request to be handled with the specified
+handler. For example, one might use this to force all files without a
+file extension to be parsed by the php handler:</p>
+
+<div class="example"><p><code>
+RewriteRule !\. - [H=application/x-httpd-php]
+</code></p></div>
+
+<p>
+The regular expression above - <code>!\.</code> - will match any request
+that does not contain the literal <code>.</code> character.
+</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
+the rule set. In most contexts, this means that if the rule matches, no
+further rules will be processed.</p>
+
+<p>If you are using <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> in either
+<code>.htaccess</code> files or in 
+<code class="directive"><a href="/mod/core.html#directory">&lt;Directory&gt;</a></code> sections,
+it is important to have some understanding of how the rules are
+processed.  The simplified form of this is that once the rules have been
+processed, the rewritten request is handed back to the URL parsing
+engine to do what it may with it. It is possible that as the rewritten
+request is handled, the <code>.htaccess</code> file or 
+<code class="directive"><a href="/mod/core.html#directory">&lt;Directory&gt;</a></code> section
+may be encountered again, and thus the ruleset may be run again from the
+start. Most commonly this will happen if one of the rules causes a
+redirect - either internal or external - causing the request process to
+start over.</p>
+
+<p>It is therefore important, if you are using <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directives in one of these
+context that you take explicit steps to avoid rules looping, and not
+count solely on the [L] flag to terminate execution of a series of
+rules, as shown below.</p>
+
+<p>The example given here will rewrite any request to
+<code>index.php</code>, giving the original request as a query string
+argument to <code>index.php</code>, however, if the request is already
+for <code>index.php</code>, this rull will be skipped.</p>
+
+<div class="example"><p><code>
+RewriteCond %{REQUEST_URI} !index\.php<br />
+RewriteRule ^(.*) index.php?req=$1 [L]
+</code></p></div>
+
+
+<h3><a name="flag_n" id="flag_n">N|next</a></h3>
+<p>
+The [N] flag causes the ruleset to start over again from the top. Use
+with extreme caution, as it may result in loop.
+</p>
+<p>
+The [Next] flag could be used, for example, if you wished to replace a
+certain string or letter repeatedly in a request. The example shown here
+will replace A with B everywhere in a request, and will continue doing
+so until there are no more As to be replaced.
+</p>
+
+<div class="example"><p><code>
+RewriteRule (.*)A(.*) $1B$2 [N]
+</code></p></div>
+
+<p>You can think of this as a <code>while</code> loop: While this
+pattern still matches, perform this substitution.</p>
+
+
+
+<h3><a name="flag_nc" id="flag_nc">NC|nocase</a></h3>
+<p>Use of the [NC] flag causes the <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> to be matched in a
+case-insensitive manner. That is, it doesn't care whether letters appear
+as upper-case or lower-case in the matched URI.</p>
+
+<p>In the example below, any request for an image file will be proxied
+to your dedicated image server. The match is case-insensitive, so that
+<code>.jpg</code> and <code>.JPG</code> files are both acceptable, for
+example.</p>
+
+<div class="example"><p><code>
+RewriteRule (.*\.(jpg|gif|png))$ http://images.example.com$1 [P,NC]
+</code></p></div>
+
+
+<h3><a name="flag_ne" id="flag_ne">NE|noescape</a></h3>
+<p>By default, special characters, such as <code>&amp;</code> and
+<code>?</code>, for example, will be converted to their hexcode
+equivalent. Using the [NE] flag prevents that from happening.
+</p>
+
+<div class="example"><p><code>
+RewriteRule ^/anchor/(.+) /bigpage.html#$1 [NE,R]
+</code></p></div>
+
+<p>
+The above example will redirect <code>/anchor/xyz</code> to
+<code>/bigpage.html#xyz</code>. Omitting the [NE] will result in the #
+being converted to its hexcode equivalent, <code>%23</code>, which will
+then result in a 404 Not Found error condition.
+</p>
+
+
+
+<h3><a name="flag_ns" id="flag_ns">NS|nosubreq</a></h3>
+<p>Use of the [NS] flag prevents the rule from being used on
+subrequests. For example, a page which is included using an SSI (Server
+Side Include) is a subrequest, and you may want to avoid rewrites
+happening on those subrequests.</p>
+
+<p>
+Images, javascript files, or css files, loaded as part of an HTML page,
+are not subrequests - the browser requests them as separate HTTP
+requests.
+</p>
+
+
+<h3><a name="flag_p" id="flag_p">P|proxy</a></h3>
+<p>Use of the [P] flag causes the request to be handled by
+<code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code>, and handled via a proxy request. For
+example, if you wanted all image requests to be handled by a back-end
+image server, you might do something like the following:</p>
+
+<div class="example"><p><code>
+RewriteRule (.*)\.(jpg|gif|png) http://images.example.com$1.$2 [P]
+</code></p></div>
+
+<p>Use of the [P] flag implies [L] - that is, the request is immediatly
+pushed through the proxy, and any following rules will not be
+considered.</p>
+
+
+
+<h3><a name="flag_pt" id="flag_pt">PT|passthrough</a></h3>
+
+<p>
+The target (or substitution string) in a RewriteRule is assumed to be a
+file path, by default. The use of the [PT] flag causes it to be trated
+as a URI instead. That is to say, the
+use of the [PT] flag causes the result of the <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> to be passed back through
+URL mapping, so that location-based mappings, such as <code class="directive"><a href="/mod/mod_alias.html#alias">Alias</a></code>, for example, might have a chance to take
+effect.
+</p>
+
+<p>
+If, for example, you have an 
+<code class="directive"><a href="/mod/mod_alias.html#alias">Alias</a></code>
+for /icons, and have a <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> pointing there, you should
+use the [PT] flag to ensure that the 
+<code class="directive"><a href="/mod/mod_alias.html#alias">Alias</a></code> is evaluated.
+</p>
+
+<div class="example"><p><code>
+Alias /icons /usr/local/apache/icons<br />
+RewriteRule /pics/(.+)\.jpg /icons/$1.gif [PT]
+</code></p></div>
+
+<p>
+Omission of the [PT] flag in this case will cause the Alias to be
+ignored, resulting in a 'File not found' error being returned.
+</p>
+
+
+
+<h3><a name="flag_qsa" id="flag_qsa">QSA|qsappend</a></h3>
+<p>
+When the replacement URI contains a query string, the default behavior
+of <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> is to discard
+the existing query string, and replace it with the newly generated one.
+Using the [QSA] flag causes the query strings to be combined.
+</p>
+
+<p>Consider the following rule:</p>
+
+<div class="example"><p><code>
+RewriteRule /pages/(.+) /page.php?page=$1 [QSA]
+</code></p></div>
+
+<p>With the [QSA] flag, a request for <code>/pages/123?one=two</code> will be
+mapped to <code>/page.php?page=123&amp;one=two</code>. Without the [QSA]
+flag, that same request will be mapped to
+<code>/page.php?page=123</code> - that is, the existing query string
+will be discarded.
+</p>
+
+
+<h3><a name="flag_r" id="flag_r">R|redirect</a></h3>
+<p>
+Use of the [R] flag causes a HTTP redirect to be issued to the browser.
+If a fully-qualified URL is specified (that is, including
+<code>http://servername/</code>) then a redirect will be issued to that
+location. Otherwise, the current servername will be used to generate the
+URL sent with the redirect.
+</p>
+
+<p>
+A status code may be specified, in the range 300-399, with a 302 status
+code being used by default if none is specified.
+</p>
+
+<p>
+You will almost always want to use [R] in conjunction with [L] (that is,
+use [R,L]) because on its own, the [R] flag prepends
+<code>http://thishost[:thisport]</code> to the URI, but then passes this
+on to the next rule in the ruleset, which can often result in 'Invalid
+URI in request' warnings.
+</p>
+
+
+
+<h3><a name="flag_s" id="flag_s">S|skip</a></h3>
+<p>The [S] flag is used to skip rules that you don't want to run. This
+can be thought of as a <code>goto</code> statement in your rewrite
+ruleset. In the following example, we only want to run the <code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> if the requested URI
+doesn't correspond with an actual file.</p>
+
+<div class="example"><p><code>
+# Is the request for a non-existent file?
+RewriteCond %{REQUEST_FILENAME} !-f<br />
+RewriteCond %{REQUEST_FILENAME} !-d<br />
+# If so, skip these two RewriteRules
+RewriteRule .? - [S=2]<br />
+<br />
+RewriteRule (.*\.gif) images.php?$1<br />
+RewriteRule (.*\.html) docs.php?$1
+</code></p></div>
+
+<p>This technique is useful because a <code class="directive"><a href="/mod/mod_rewrite.html#rewritecond">RewriteCond</a></code> only applies to the
+<code class="directive"><a href="/mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> immediately
+following it. Thus, if you want to make a <code>RewriteCond</code> apply
+to several <code>RewriteRule</code>s, one possible technique is to
+negate those conditions and use a [Skip] flag.</p>
+
+
+
+<h3><a name="flag_t" id="flag_t">T|type</a></h3>
+<p>Sets the MIME type with which the resulting response will be
+sent. This has the same effect as the <code class="directive"><a href="/mod/mod_mime.html#addtype">AddType</a></code> directive.</p>
+
+<p>For example, you might use the following technique to serve Perl
+source code as plain text, if requested in a particular way:</p>
+
+<div class="example"><p><code>
+# Serve .pl files as plan text
+RewriteRule \.pl$ - [T=text/plain]
+</code></p></div>
+
+<p>Or, perhaps, if you have a camera that produces jpeg images without
+file extensions, you could force those images to be served with the
+correct MIME type by virtue of their file names:</p>
+
+<div class="example"><p><code>
+# Files with 'IMG' in the name are jpg images.<br />
+RewriteRule IMG - [T=image/jpg]
+</code></p></div>
+
+<p>Please note that this is a trivial example, and could be better done
+using <code class="directive"><a href="/mod/core.html#filesmatch">&lt;FilesMatch&gt;</a></code>
+instead. Always consider the alternate
+solutions to a problem before resorting to rewrite, which will
+invariably be a less efficient solution than the alternatives.</p>
+
+
+</div></div>
+<div class="bottomlang">
+<p><span>Available Languages: </span></p>
+</div><div id="footer">
+<p class="apache">Copyright 2008 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
+<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
+</body></html>
\ No newline at end of file

Added: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml?rev=636379&view=auto
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml (added)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml Wed Mar 12 08:53:58 2008
@@ -0,0 +1,433 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
+<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
+<!-- $LastChangedRevision: 636374 $ -->
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manualpage metafile="flags.xml.meta">
+<parentdocument href="./index.html"/>
+
+  <title>Apache mod_rewrite Flags</title>
+
+<summary>
+<p>This document discusses the flags which are available to the
+<directive module="mod_rewrite">RewriteRule</directive> directive,
+providing detailed explanations and examples. This is not necessarily
+a comprehensive list of all flags available, so be sure to also
+consult the reference documentation.</p>
+</summary>
+
+<seealso><a href="../mod/mod_rewrite.html">Module documentation</a></seealso>
+<seealso><a href="rewrite_tech.html">Technical details</a></seealso>
+<seealso><a href="rewrite_guide.html">Rewrite Guide - useful examples</a></seealso>
+<seealso><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide -
+advanced useful examples</a></seealso>
+
+<section id="introduction"><title>Introduction</title>
+<p><directive module="mod_rewrite">RewriteRule</directive>s can have
+their behavior modified by one or more flags. Flags are included in
+square brackets at the end of the rule, and multiple flags are separated
+by commas.</p>
+<example>
+RewriteRule pattern target [Flag1,Flag2,Flag3]
+</example>
+
+<p>The flags all have a short form, such as <code>CO</code>, as well as
+a longer form, such as <code>cookie</code>. Some flags take one or more
+arguments. Flags are not case sensitive.</p>
+
+</section>
+
+<section id="flags"><title>The flags</title>
+
+<p>Each flag has a long and short form. While it is most common to use
+the short form, it is recommended that you familiarize yourself with the
+long form, so that you remember what each flag is supposed to do.</p>
+
+<p>Presented here are each of the available flags, along with an example
+of how you might use them.</p>
+
+<section id="flag_c"><title>C|chain</title>
+<p>The [C] or [chain] flag indicates that the <directive
+module="mod_rewrite">RewriteRule</directive> is chained to the next
+rule. That is, if the rule matches, then it is processed as usual and
+control moves on to the next rule. However, if it does not match, then
+the next rule, and any other rules that are chained together, will be
+skipped.</p>
+
+</section>
+
+<section id="flag_co"><title>CO|cookie</title>
+<p>The [CO], or [cookie] flag, allows you to set a cookie when a
+particular <directive module="mod_rewrite">RewriteRule</directive>
+matches. The argument consists of three required fields and two optional
+fields.</p>
+<p>You must declare a name and value for the cookie to be set, and the
+domain for which you wish the cookie to be valid. You may optionally set
+the lifetime of the cookie, and the path for which it should be
+returned.</p>
+<p>By default, the lifetime of the cookie is the current browser
+session.</p>
+<p>By default, the path for which the cookie will be valid is "/" - that
+is, the entire website.</p>
+<p>Several examples are offered here:</p>
+
+<example>
+RewriteEngine On<br />
+RewriteRule ^/index.html - [CO=frontdoor:yes:.apache.org:1440:/]
+</example>
+
+<p>This rule doesn't rewrite the request (the "-" rewrite target tells
+mod_rewrite to pass the request through unchanged) but sets a cookie
+called 'frontdoor' to a value of 'yes'. The cookie is valid for any host
+in the <code>.apache.org</code> domain. It will be set to expire in 1440
+minutes (24 hours) and will be returned for all URIs.</p>
+
+</section>
+
+<section id="flag_e"><title>E|env</title>
+<p>With the [E], or [env] flag, you can set the value of an environment
+variable. Note that some environment variables may be set after the rule
+is run, thus unsetting what you have set. See <a href="../env.html">the
+Environment Variables document</a> for more details on how Environment
+variables work.</p>
+
+<p>The following example sets an evironment variable called 'image' to a
+value of '1' if the requested URI is an image file. Then, that
+environment variable is used to exclude those requests from the access
+log.</p>
+
+<example>
+RewriteRule \.(png|gif|jpg) - [E=image:1]<br />
+CustomLog logs/access_log combined env=!image
+</example>
+
+<p>Note that this same effect can be obtained using <directive
+module="mod_setenvif">SetEnvIf</directive>. This technique is offered as
+an example, not as a recommendation.</p>
+</section>
+
+<section id="flag_f"><title>F|forbidden</title>
+<p>Using the [F] flag causes Apache to return a 403 Forbidden status
+code to the client. While the same behavior can be accomplished using
+the <directive module="mod_access">Deny</directive> directive, this 
+allows more flexibility in assigning a Forbidden status.</p>
+
+<p>The following rule will forbid <code>.exe</code> files from being
+downloaded from your server.</p>
+
+<example>
+RewriteRule \.exe - [F]
+</example>
+
+<p>This example uses the "-" syntax for the rewrite target, which means
+that the requested URI is not modified. There's no reason to rewrite to
+another URI, if you're going to forbid the request.</p>
+
+</section>
+
+<section id="flag_g"><title>G|gone</title>
+<p>The [G] flag forces Apache to return a 410 Gone status with the
+response. This indicates that a resource used to be available, but is no
+longer available.</p>
+
+<p>As with the [F] flag, you will typically use the "-" syntax for the
+rewrite target when using the [G] flag:</p>
+
+<example>
+RewriteRule oldproduct - [G,NC]
+</example>
+</section>
+
+<section id="flag_h"><title>H|handler</title>
+<p>Forces the resulting request to be handled with the specified
+handler. For example, one might use this to force all files without a
+file extension to be parsed by the php handler:</p>
+
+<example>
+RewriteRule !\. - [H=application/x-httpd-php]
+</example>
+
+<p>
+The regular expression above - <code>!\.</code> - will match any request
+that does not contain the literal <code>.</code> character.
+</p>
+</section>
+
+<section id="flag_l"><title>L|last</title>
+<p>The [L] flag causes <module>mod_rewrite</module> to stop processing
+the rule set. In most contexts, this means that if the rule matches, no
+further rules will be processed.</p>
+
+<p>If you are using <directive
+module="mod_rewrite">RewriteRule</directive> in either
+<code>.htaccess</code> files or in 
+<directive type="section" module="core">Directory</directive> sections,
+it is important to have some understanding of how the rules are
+processed.  The simplified form of this is that once the rules have been
+processed, the rewritten request is handed back to the URL parsing
+engine to do what it may with it. It is possible that as the rewritten
+request is handled, the <code>.htaccess</code> file or 
+<directive type="section" module="core">Directory</directive> section
+may be encountered again, and thus the ruleset may be run again from the
+start. Most commonly this will happen if one of the rules causes a
+redirect - either internal or external - causing the request process to
+start over.</p>
+
+<p>It is therefore important, if you are using <directive
+module="mod_rewrite">RewriteRule</directive> directives in one of these
+context that you take explicit steps to avoid rules looping, and not
+count solely on the [L] flag to terminate execution of a series of
+rules, as shown below.</p>
+
+<p>The example given here will rewrite any request to
+<code>index.php</code>, giving the original request as a query string
+argument to <code>index.php</code>, however, if the request is already
+for <code>index.php</code>, this rull will be skipped.</p>
+
+<example>
+RewriteCond %{REQUEST_URI} !index\.php<br />
+RewriteRule ^(.*) index.php?req=$1 [L]
+</example>
+</section>
+
+<section id="flag_n"><title>N|next</title>
+<p>
+The [N] flag causes the ruleset to start over again from the top. Use
+with extreme caution, as it may result in loop.
+</p>
+<p>
+The [Next] flag could be used, for example, if you wished to replace a
+certain string or letter repeatedly in a request. The example shown here
+will replace A with B everywhere in a request, and will continue doing
+so until there are no more As to be replaced.
+</p>
+
+<example>
+RewriteRule (.*)A(.*) $1B$2 [N]
+</example>
+
+<p>You can think of this as a <code>while</code> loop: While this
+pattern still matches, perform this substitution.</p>
+
+</section>
+
+<section id="flag_nc"><title>NC|nocase</title>
+<p>Use of the [NC] flag causes the <directive
+module="mod_rewrite">RewriteRule</directive> to be matched in a
+case-insensitive manner. That is, it doesn't care whether letters appear
+as upper-case or lower-case in the matched URI.</p>
+
+<p>In the example below, any request for an image file will be proxied
+to your dedicated image server. The match is case-insensitive, so that
+<code>.jpg</code> and <code>.JPG</code> files are both acceptable, for
+example.</p>
+
+<example>
+RewriteRule (.*\.(jpg|gif|png))$ http://images.example.com$1 [P,NC]
+</example>
+</section>
+
+<section id="flag_ne"><title>NE|noescape</title>
+<p>By default, special characters, such as <code>&amp;</code> and
+<code>?</code>, for example, will be converted to their hexcode
+equivalent. Using the [NE] flag prevents that from happening.
+</p>
+
+<example>
+RewriteRule ^/anchor/(.+) /bigpage.html#$1 [NE,R]
+</example>
+
+<p>
+The above example will redirect <code>/anchor/xyz</code> to
+<code>/bigpage.html#xyz</code>. Omitting the [NE] will result in the #
+being converted to its hexcode equivalent, <code>%23</code>, which will
+then result in a 404 Not Found error condition.
+</p>
+
+</section>
+
+<section id="flag_ns"><title>NS|nosubreq</title>
+<p>Use of the [NS] flag prevents the rule from being used on
+subrequests. For example, a page which is included using an SSI (Server
+Side Include) is a subrequest, and you may want to avoid rewrites
+happening on those subrequests.</p>
+
+<p>
+Images, javascript files, or css files, loaded as part of an HTML page,
+are not subrequests - the browser requests them as separate HTTP
+requests.
+</p>
+</section>
+
+<section id="flag_p"><title>P|proxy</title>
+<p>Use of the [P] flag causes the request to be handled by
+<module>mod_proxy</module>, and handled via a proxy request. For
+example, if you wanted all image requests to be handled by a back-end
+image server, you might do something like the following:</p>
+
+<example>
+RewriteRule (.*)\.(jpg|gif|png) http://images.example.com$1.$2 [P]
+</example>
+
+<p>Use of the [P] flag implies [L] - that is, the request is immediatly
+pushed through the proxy, and any following rules will not be
+considered.</p>
+
+</section>
+
+<section id="flag_pt"><title>PT|passthrough</title>
+
+<p>
+The target (or substitution string) in a RewriteRule is assumed to be a
+file path, by default. The use of the [PT] flag causes it to be trated
+as a URI instead. That is to say, the
+use of the [PT] flag causes the result of the <directive
+module="mod_rewrite">RewriteRule</directive> to be passed back through
+URL mapping, so that location-based mappings, such as <directive
+module="mod_alias">Alias</directive>, for example, might have a chance to take
+effect.
+</p>
+
+<p>
+If, for example, you have an 
+<directive module="mod_alias">Alias</directive>
+for /icons, and have a <directive
+module="mod_rewrite">RewriteRule</directive> pointing there, you should
+use the [PT] flag to ensure that the 
+<directive module="mod_alias">Alias</directive> is evaluated.
+</p>
+
+<example>
+Alias /icons /usr/local/apache/icons<br />
+RewriteRule /pics/(.+)\.jpg /icons/$1.gif [PT]
+</example>
+
+<p>
+Omission of the [PT] flag in this case will cause the Alias to be
+ignored, resulting in a 'File not found' error being returned.
+</p>
+
+</section>
+
+<section id="flag_qsa"><title>QSA|qsappend</title>
+<p>
+When the replacement URI contains a query string, the default behavior
+of <directive module="mod_rewrite">RewriteRule</directive> is to discard
+the existing query string, and replace it with the newly generated one.
+Using the [QSA] flag causes the query strings to be combined.
+</p>
+
+<p>Consider the following rule:</p>
+
+<example>
+RewriteRule /pages/(.+) /page.php?page=$1 [QSA]
+</example>
+
+<p>With the [QSA] flag, a request for <code>/pages/123?one=two</code> will be
+mapped to <code>/page.php?page=123&amp;one=two</code>. Without the [QSA]
+flag, that same request will be mapped to
+<code>/page.php?page=123</code> - that is, the existing query string
+will be discarded.
+</p>
+</section>
+
+<section id="flag_r"><title>R|redirect</title>
+<p>
+Use of the [R] flag causes a HTTP redirect to be issued to the browser.
+If a fully-qualified URL is specified (that is, including
+<code>http://servername/</code>) then a redirect will be issued to that
+location. Otherwise, the current servername will be used to generate the
+URL sent with the redirect.
+</p>
+
+<p>
+A status code may be specified, in the range 300-399, with a 302 status
+code being used by default if none is specified.
+</p>
+
+<p>
+You will almost always want to use [R] in conjunction with [L] (that is,
+use [R,L]) because on its own, the [R] flag prepends
+<code>http://thishost[:thisport]</code> to the URI, but then passes this
+on to the next rule in the ruleset, which can often result in 'Invalid
+URI in request' warnings.
+</p>
+
+</section>
+
+<section id="flag_s"><title>S|skip</title>
+<p>The [S] flag is used to skip rules that you don't want to run. This
+can be thought of as a <code>goto</code> statement in your rewrite
+ruleset. In the following example, we only want to run the <directive
+module="mod_rewrite">RewriteRule</directive> if the requested URI
+doesn't correspond with an actual file.</p>
+
+<example>
+# Is the request for a non-existent file?
+RewriteCond %{REQUEST_FILENAME} !-f<br />
+RewriteCond %{REQUEST_FILENAME} !-d<br />
+# If so, skip these two RewriteRules
+RewriteRule .? - [S=2]<br />
+<br />
+RewriteRule (.*\.gif) images.php?$1<br />
+RewriteRule (.*\.html) docs.php?$1
+</example>
+
+<p>This technique is useful because a <directive
+module="mod_rewrite">RewriteCond</directive> only applies to the
+<directive module="mod_rewrite">RewriteRule</directive> immediately
+following it. Thus, if you want to make a <code>RewriteCond</code> apply
+to several <code>RewriteRule</code>s, one possible technique is to
+negate those conditions and use a [Skip] flag.</p>
+
+</section>
+
+<section id="flag_t"><title>T|type</title>
+<p>Sets the MIME type with which the resulting response will be
+sent. This has the same effect as the <directive
+module="mod_mime">AddType</directive> directive.</p>
+
+<p>For example, you might use the following technique to serve Perl
+source code as plain text, if requested in a particular way:</p>
+
+<example>
+# Serve .pl files as plan text
+RewriteRule \.pl$ - [T=text/plain]
+</example>
+
+<p>Or, perhaps, if you have a camera that produces jpeg images without
+file extensions, you could force those images to be served with the
+correct MIME type by virtue of their file names:</p>
+
+<example>
+# Files with 'IMG' in the name are jpg images.<br />
+RewriteRule IMG - [T=image/jpg]
+</example>
+
+<p>Please note that this is a trivial example, and could be better done
+using <directive type="section" module="core">FilesMatch</directive>
+instead. Always consider the alternate
+solutions to a problem before resorting to rewrite, which will
+invariably be a less efficient solution than the alternatives.</p>
+</section>
+
+</section>
+</manualpage>
+

Added: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml.meta
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml.meta?rev=636379&view=auto
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml.meta (added)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_flags.xml.meta Wed Mar 12 08:53:58 2008
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<metafile>
+  <basename>rewrite_flags</basename>
+  <path>/rewrite/</path>
+  <relpath>..</relpath>
+
+  <variants>
+    <variant>en</variant>
+  </variants>
+</metafile>

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.html.en?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.html.en (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.html.en Wed Mar 12 08:53:58 2008
@@ -18,8 +18,7 @@
 <div id="path">
 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Rewrite</a></div><div id="page-content"><div id="preamble"><h1>URL Rewriting Guide</h1>
 <div class="toplang">
-<p><span>Available Languages: </span><a href="../en/rewrite/rewrite_guide.html" title="English">&nbsp;en&nbsp;</a> |
-<a href="../working/rewrite/rewrite_guide.html" hreflang="working" rel="alternate" title="">&nbsp;working&nbsp;</a></p>
+<p><span>Available Languages: </span><a href="../en/rewrite/rewrite_guide.html" title="English">&nbsp;en&nbsp;</a></p>
 </div>
 
 
@@ -62,8 +61,8 @@
 <li><img alt="" src="../images/down.gif" /> <a href="#external-rewriting">External Rewriting Engine</a></li>
 </ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module
 documentation</a></li><li><a href="rewrite_intro.html">mod_rewrite
-introduction</a></li><li><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></li><li><a href="rewrite_tech.html">Technical details</a></li></ul></div>
+introduction</a></li><li><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide - advanced 
+useful examples</a></li><li><a href="rewrite_tech.html">Technical details</a></li></ul></div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="canonicalurl" id="canonicalurl">Canonical URLs</a></h2>
@@ -281,12 +280,12 @@
 <div class="example"><pre>
 RewriteEngine on
 
-#   first try to find it in custom/...
+#   first try to find it in dir1/...
 #   ...and if found stop and be happy:
 RewriteCond         /your/docroot/<strong>dir1</strong>/%{REQUEST_FILENAME}  -f
 RewriteRule  ^(.+)  /your/docroot/<strong>dir1</strong>/$1  [L]
 
-#   second try to find it in pub/...
+#   second try to find it in dir2/...
 #   ...and if found stop and be happy:
 RewriteCond         /your/docroot/<strong>dir2</strong>/%{REQUEST_FILENAME}  -f
 RewriteRule  ^(.+)  /your/docroot/<strong>dir2</strong>/$1  [L]
@@ -588,7 +587,8 @@
 
         <dd>
           <p>We just rewrite the URL to the CGI-script and force the
-          correct MIME-type so it gets really run as a CGI-script.
+          handler to be <strong>cgi-script</strong> so that it is
+          executed as a CGI program.
           This way a request to <code>/~quux/foo.html</code>
           internally leads to the invocation of
           <code>/~quux/foo.cgi</code>.</p>
@@ -596,7 +596,7 @@
 <div class="example"><pre>
 RewriteEngine  on
 RewriteBase    /~quux/
-RewriteRule    ^foo\.<strong>html</strong>$  foo.<strong>cgi</strong>  [T=<strong>application/x-httpd-cgi</strong>]
+RewriteRule    ^foo\.<strong>html</strong>$  foo.<strong>cgi</strong>  [H=<strong>cgi-script</strong>]
 </pre></div>
         </dd>
       </dl>
@@ -770,8 +770,7 @@
 
     </div></div>
 <div class="bottomlang">
-<p><span>Available Languages: </span><a href="../en/rewrite/rewrite_guide.html" title="English">&nbsp;en&nbsp;</a> |
-<a href="../working/rewrite/rewrite_guide.html" hreflang="working" rel="alternate" title="">&nbsp;working&nbsp;</a></p>
+<p><span>Available Languages: </span><a href="../en/rewrite/rewrite_guide.html" title="English">&nbsp;en&nbsp;</a></p>
 </div><div id="footer">
 <p class="apache">Copyright 2008 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.xml?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide.xml Wed Mar 12 08:53:58 2008
@@ -49,8 +49,8 @@
 documentation</a></seealso>
 <seealso><a href="rewrite_intro.html">mod_rewrite
 introduction</a></seealso>
-<seealso><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></seealso>
+<seealso><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide - advanced 
+useful examples</a></seealso>
 <seealso><a href="rewrite_tech.html">Technical details</a></seealso>
 
 
@@ -271,12 +271,12 @@
 <example><pre>
 RewriteEngine on
 
-#   first try to find it in custom/...
+#   first try to find it in dir1/...
 #   ...and if found stop and be happy:
 RewriteCond         /your/docroot/<strong>dir1</strong>/%{REQUEST_FILENAME}  -f
 RewriteRule  ^(.+)  /your/docroot/<strong>dir1</strong>/$1  [L]
 
-#   second try to find it in pub/...
+#   second try to find it in dir2/...
 #   ...and if found stop and be happy:
 RewriteCond         /your/docroot/<strong>dir2</strong>/%{REQUEST_FILENAME}  -f
 RewriteRule  ^(.+)  /your/docroot/<strong>dir2</strong>/$1  [L]
@@ -578,7 +578,8 @@
 
         <dd>
           <p>We just rewrite the URL to the CGI-script and force the
-          correct MIME-type so it gets really run as a CGI-script.
+          handler to be <strong>cgi-script</strong> so that it is
+          executed as a CGI program.
           This way a request to <code>/~quux/foo.html</code>
           internally leads to the invocation of
           <code>/~quux/foo.cgi</code>.</p>
@@ -586,7 +587,7 @@
 <example><pre>
 RewriteEngine  on
 RewriteBase    /~quux/
-RewriteRule    ^foo\.<strong>html</strong>$  foo.<strong>cgi</strong>  [T=<strong>application/x-httpd-cgi</strong>]
+RewriteRule    ^foo\.<strong>html</strong>$  foo.<strong>cgi</strong>  [H=<strong>cgi-script</strong>]
 </pre></example>
         </dd>
       </dl>

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.html.en?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.html.en (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.html.en Wed Mar 12 08:53:58 2008
@@ -60,8 +60,8 @@
 <li><img alt="" src="../images/down.gif" /> <a href="#referer-deflector">Referer-based Deflector</a></li>
 </ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module
 documentation</a></li><li><a href="rewrite_intro.html">mod_rewrite
-introduction</a></li><li><a href="rewrite_guide.html">Practical solutions to common
-problems</a></li><li><a href="rewrite_tech.html">Technical details</a></li></ul></div>
+introduction</a></li><li><a href="rewrite_guide.html">Rewrite Guide - useful
+examples</a></li><li><a href="rewrite_tech.html">Technical details</a></li></ul></div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="cluster" id="cluster">Webcluster through Homogeneous URL Layout</a></h2>

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.xml?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_guide_advanced.xml Wed Mar 12 08:53:58 2008
@@ -49,8 +49,8 @@
 documentation</a></seealso>
 <seealso><a href="rewrite_intro.html">mod_rewrite
 introduction</a></seealso>
-<seealso><a href="rewrite_guide.html">Practical solutions to common
-problems</a></seealso>
+<seealso><a href="rewrite_guide.html">Rewrite Guide - useful
+examples</a></seealso>
 <seealso><a href="rewrite_tech.html">Technical details</a></seealso>
 
 

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en Wed Mar 12 08:53:58 2008
@@ -35,7 +35,6 @@
 <li><img alt="" src="../images/down.gif" /> <a href="#rewritecond">Rewrite conditions</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#rewritemap">Rewrite maps</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#htaccess">.htaccess files</a></li>
-<li><img alt="" src="../images/down.gif" /> <a href="#EnvVar">Environment Variables</a></li>
 </ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module
 documentation</a></li><li><a href="rewrite_tech.html">Technical details</a></li><li><a href="rewrite_guide.html">Practical solutions to common
 problems</a></li><li><a href="rewrite_guide_advanced.html">Practical solutions to
@@ -53,6 +52,19 @@
 <p>This document attempts to give sufficient background so that what
 follows is understood, rather than just copied blindly.
 </p>
+
+<p>Remember that many common URL-manipulation tasks don't require the
+full power and complexity of <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. For simple
+tasks, see <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> and the documentation
+on <a href="../urlmapping.html">mapping URLs to the
+filesystem</a>.</p>
+
+<p>Finally, before proceding, be sure to configure
+the <code class="directive"><a href="../mod/mod_rewrite.html#rewritelog">RewriteLog</a></code>. Although
+this log file can give an overwhelming amount of information, it is
+indispensable in debugging problems with <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
+configuration, since it will tell you exactly how each rule is
+processed.</p>
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="regex" id="regex">Regular Expressions</a></h2>
@@ -137,54 +149,156 @@
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="rewriterule" id="rewriterule">RewriteRule basics</a></h2>
-<p>
-Basic anatomy of a RewriteRule, with exhaustively annotated simple
-examples.
-</p>
+<p>A <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> consists
+of three arguments separated by spaces. The arguments are</p>
+<ol>
+<li><var>Pattern</var>: which incoming URLs should be affected by the rule;</li>
+<li><var>Substitution</var>: where should the matching requests be sent;</li>
+<li><var>[flags]</var>: options affecting the rewritten request.</li>
+</ol>
+
+<p>The <var>Pattern</var> is always a <a href="#regex">regular
+expression</a> matched against the URL-Path of the incoming request
+(the part after the hostname but before any question mark indicating
+the beginning of a query string).</p>
+
+<p>The <var>Substitution</var> can itself be one of three things:</p>
+
+<dl>
+<dt>A full filesystem path to a resource</dt>
+<dd>
+<div class="example"><p><code>
+RewriteRule ^/games.* /usr/local/games/web
+</code></p></div>
+<p>This maps a request to an arbitrary location on your filesystem, much
+like the <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> directive.</p>
+</dd>
+
+<dt>A web-path to a resource</dt>
+<dd>
+<div class="example"><p><code>
+RewriteRule ^/foo$ /bar
+</code></p></div>
+<p>If <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> is set
+to <code>/usr/local/apache2/htdocs</code>, then this directive would
+map requests for <code>http://example.com/foo</code> to the
+path <code>/usr/local/apache2/htdocs/bar</code>.</p>
+</dd>
+
+<dt>An absolute URL</dt>
+<dd>
+<div class="example"><p><code>
+RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R]
+</code></p></div>
+<p>This tells the client to make a new request for the specified URL.</p>
+</dd>
+</dl>
+
+<p>The <var>Substitution</var> can also
+contain <em>back-references</em> to parts of the incoming URL-path
+matched by the <var>Pattern</var>. Consider the following:</p>
+<div class="example"><p><code>
+RewriteRule ^/product/(.*)/view$ /var/web/productdb/$1
+</code></p></div>
+<p>The variable <code>$1</code> will be replaced with whatever text
+was matched by the expression inside the parenthesis in
+the <var>Pattern</var>. For example, a request
+for <code>http://example.com/product/r14df/view</code> will be mapped
+to the path <code>/var/web/productdbr14df</code>.</p>
+
+<p>If there is more than one expression in parenthesis, they are
+available in order in the
+variables <code>$1</code>, <code>$2</code>, <code>$3</code>, and so
+on.</p>
+
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="flags" id="flags">Rewrite Flags</a></h2>
-<p>Discussion of the flags to RewriteRule, and when and why one might
-use them.</p>
+<p>The behavior of a <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> can be modified by the
+application of one more flags to the end of the rule. For example, the
+matching behavior of a rule can be made case-insensitive by the
+application of the <code>[NC]</code> flag:
+</p>
+<div class="example"><p><code>
+RewriteRule ^puppy.html smalldog.html [NC]
+</code></p></div>
+
+<p>For more details on the available flags, their meanings, and
+examples, see the <a href="rewrite_flags.html">Rewrite Flags</a> document.</p>
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="rewritecond" id="rewritecond">Rewrite conditions</a></h2>
-<p>Discussion of RewriteCond, looping, and other related concepts.
-</p>
+<p>One or more <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code>
+directives can be used to restrict the types of requests that will be
+subject to the
+following <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>. The
+first argument is a variable describing a characteristic of the
+request, the second argument is a <a href="#regex">regular
+expression</a> that must match the variable, and a third optional
+argument is a list of flags that modify how the match is evaluated.</p>
+
+<p>For example, to send all requests from a particular IP range to a
+different server, you could use:</p>
+<div class="example"><p><code>
+RewriteCond %{REMOTE_ADDR} ^10\2.<br />
+RewriteRule (.*) http://intranet.example.com$1
+</code></p></div>
+
+<p>When more than
+one <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code> is
+specified, they must all match for
+the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> to be
+applied. For example, to deny requests that contain the word "hack" in
+their query string, except if they also contain a cookie containing
+the word "go", you could use:</p>
+<div class="example"><p><code>
+RewriteCond %{QUERY_STRING} hack<br />
+RewriteCond %{HTTP_COOKIE} !go<br />
+RewriteRule .* - [F]
+</code></p></div>
+<p>Notice that the exclamation mark specifies a negative match, so the rule is only applied if the cookie does not contain "go".</p>
+
+<p>Matches in the regular expressions contained in
+the <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code>s can be
+used as part of the <var>Substitution</var> in
+the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> using the
+variables <code>%1</code>, <code>%2</code>, etc. For example, this
+will direct the request to a different directory depending on the
+hostname used to access the site:</p>
+<div class="example"><p><code>
+RewriteCond %{HTTP_HOST} (.*)<br />
+RewriteRule ^/(.*) /sites/%1/$1
+</code></p></div>
+<p>If the request was for <code>http://example.com/foo/bar</code>,
+then <code>%1</code> would contain <code>example.com</code>
+and <code>$1</code> would contain <code>foo/bar</code>.</p>
+
+
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="rewritemap" id="rewritemap">Rewrite maps</a></h2>
-<p>Discussion of RewriteMap, including simple, but heavily annotated,
-examples.</p>
+<p>See <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>.</p>
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="htaccess" id="htaccess">.htaccess files</a></h2>
-<p>Discussion of the differences between rewrite rules in httpd.conf and
-in .htaccess files.</p>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
-<div class="section">
-<h2><a name="EnvVar" id="EnvVar">Environment Variables</a></h2>
 
-<p>This module keeps track of two additional (non-standard)
-CGI/SSI environment variables named <code>SCRIPT_URL</code>
-and <code>SCRIPT_URI</code>. These contain the
-<em>logical</em> Web-view to the current resource, while the
-standard CGI/SSI variables <code>SCRIPT_NAME</code> and
-<code>SCRIPT_FILENAME</code> contain the <em>physical</em>
-System-view. </p>
-
-<p>Notice: These variables hold the URI/URL <em>as they were
-initially requested</em>, <em>i.e.</em>, <em>before</em> any
-rewriting. This is important because the rewriting process is
-primarily used to rewrite logical URLs to physical
-pathnames.</p>
-
-<div class="example"><h3>Example</h3><pre>
-SCRIPT_NAME=/sw/lib/w3s/tree/global/u/rse/.www/index.html
-SCRIPT_FILENAME=/u/rse/.www/index.html
-SCRIPT_URL=/u/rse/
-SCRIPT_URI=http://en1.engelschall.com/u/rse/
-</pre></div>
+<p>Rewriting is typically configured in the main server configuration
+setting (outside any <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code> section) or
+inside <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
+containers. This is the easiest way to do rewriting and is
+recommended. It is possible, however, to do rewriting
+inside <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code>
+sections or <a href="../howto/htaccess.html"><code>.htaccess</code>
+files</a> at the expense of some additional complexity. This technique
+is called per-directory rewrites.</p>
+
+<p>The main difference with per-directory rewrites is that the path
+prefix of the directory containing the <code>.htaccess</code> file is
+stripped before matching in
+the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>. In addition, the <code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code> should be used to assure the request is properly mapped.</p>
 
 </div></div>
 <div class="bottomlang">

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml Wed Mar 12 08:53:58 2008
@@ -53,6 +53,19 @@
 <p>This document attempts to give sufficient background so that what
 follows is understood, rather than just copied blindly.
 </p>
+
+<p>Remember that many common URL-manipulation tasks don't require the
+full power and complexity of <module>mod_rewrite</module>. For simple
+tasks, see <module>mod_alias</module> and the documentation
+on <a href="../urlmapping.html">mapping URLs to the
+filesystem</a>.</p>
+
+<p>Finally, before proceding, be sure to configure
+the <directive module="mod_rewrite">RewriteLog</directive>. Although
+this log file can give an overwhelming amount of information, it is
+indispensable in debugging problems with <module>mod_rewrite</module>
+configuration, since it will tell you exactly how each rule is
+processed.</p>
 </section>
 
 <section id="regex"><title>Regular Expressions</title>
@@ -140,56 +153,159 @@
 </section>
 
 <section id="rewriterule"><title>RewriteRule basics</title>
-<p>
-Basic anatomy of a RewriteRule, with exhaustively annotated simple
-examples.
-</p>
+<p>A <directive module="mod_rewrite">RewriteRule</directive> consists
+of three arguments separated by spaces. The arguments are</p>
+<ol>
+<li><var>Pattern</var>: which incoming URLs should be affected by the rule;</li>
+<li><var>Substitution</var>: where should the matching requests be sent;</li>
+<li><var>[flags]</var>: options affecting the rewritten request.</li>
+</ol>
+
+<p>The <var>Pattern</var> is always a <a href="#regex">regular
+expression</a> matched against the URL-Path of the incoming request
+(the part after the hostname but before any question mark indicating
+the beginning of a query string).</p>
+
+<p>The <var>Substitution</var> can itself be one of three things:</p>
+
+<dl>
+<dt>A full filesystem path to a resource</dt>
+<dd>
+<example>
+RewriteRule ^/games.* /usr/local/games/web
+</example>
+<p>This maps a request to an arbitrary location on your filesystem, much
+like the <directive module="mod_alias">Alias</directive> directive.</p>
+</dd>
+
+<dt>A web-path to a resource</dt>
+<dd>
+<example>
+RewriteRule ^/foo$ /bar
+</example>
+<p>If <directive module="core">DocumentRoot</directive> is set
+to <code>/usr/local/apache2/htdocs</code>, then this directive would
+map requests for <code>http://example.com/foo</code> to the
+path <code>/usr/local/apache2/htdocs/bar</code>.</p>
+</dd>
+
+<dt>An absolute URL</dt>
+<dd>
+<example>
+RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R]
+</example>
+<p>This tells the client to make a new request for the specified URL.</p>
+</dd>
+</dl>
+
+<p>The <var>Substitution</var> can also
+contain <em>back-references</em> to parts of the incoming URL-path
+matched by the <var>Pattern</var>. Consider the following:</p>
+<example>
+RewriteRule ^/product/(.*)/view$ /var/web/productdb/$1
+</example>
+<p>The variable <code>$1</code> will be replaced with whatever text
+was matched by the expression inside the parenthesis in
+the <var>Pattern</var>. For example, a request
+for <code>http://example.com/product/r14df/view</code> will be mapped
+to the path <code>/var/web/productdbr14df</code>.</p>
+
+<p>If there is more than one expression in parenthesis, they are
+available in order in the
+variables <code>$1</code>, <code>$2</code>, <code>$3</code>, and so
+on.</p>
+
+
 </section>
 
 <section id="flags"><title>Rewrite Flags</title>
-<p>Discussion of the flags to RewriteRule, and when and why one might
-use them.</p>
+<p>The behavior of a <directive
+module="mod_rewrite">RewriteRule</directive> can be modified by the
+application of one more flags to the end of the rule. For example, the
+matching behavior of a rule can be made case-insensitive by the
+application of the <code>[NC]</code> flag:
+</p>
+<example>
+RewriteRule ^puppy.html smalldog.html [NC]
+</example>
+
+<p>For more details on the available flags, their meanings, and
+examples, see the <a href="rewrite_flags.html">Rewrite Flags</a> document.</p>
+
 </section>
 
+
 <section id="rewritecond"><title>Rewrite conditions</title>
-<p>Discussion of RewriteCond, looping, and other related concepts.
-</p>
+<p>One or more <directive module="mod_rewrite">RewriteCond</directive>
+directives can be used to restrict the types of requests that will be
+subject to the
+following <directive module="mod_rewrite">RewriteRule</directive>. The
+first argument is a variable describing a characteristic of the
+request, the second argument is a <a href="#regex">regular
+expression</a> that must match the variable, and a third optional
+argument is a list of flags that modify how the match is evaluated.</p>
+
+<p>For example, to send all requests from a particular IP range to a
+different server, you could use:</p>
+<example>
+RewriteCond %{REMOTE_ADDR} ^10\2.<br />
+RewriteRule (.*) http://intranet.example.com$1
+</example>
+
+<p>When more than
+one <directive module="mod_rewrite">RewriteCond</directive> is
+specified, they must all match for
+the <directive module="mod_rewrite">RewriteRule</directive> to be
+applied. For example, to deny requests that contain the word "hack" in
+their query string, except if they also contain a cookie containing
+the word "go", you could use:</p>
+<example>
+RewriteCond %{QUERY_STRING} hack<br />
+RewriteCond %{HTTP_COOKIE} !go<br />
+RewriteRule .* - [F]
+</example>
+<p>Notice that the exclamation mark specifies a negative match, so the rule is only applied if the cookie does not contain "go".</p>
+
+<p>Matches in the regular expressions contained in
+the <directive module="mod_rewrite">RewriteCond</directive>s can be
+used as part of the <var>Substitution</var> in
+the <directive module="mod_rewrite">RewriteRule</directive> using the
+variables <code>%1</code>, <code>%2</code>, etc. For example, this
+will direct the request to a different directory depending on the
+hostname used to access the site:</p>
+<example>
+RewriteCond %{HTTP_HOST} (.*)<br />
+RewriteRule ^/(.*) /sites/%1/$1
+</example>
+<p>If the request was for <code>http://example.com/foo/bar</code>,
+then <code>%1</code> would contain <code>example.com</code>
+and <code>$1</code> would contain <code>foo/bar</code>.</p>
+
+
+
 </section>
 
 <section id="rewritemap"><title>Rewrite maps</title>
-<p>Discussion of RewriteMap, including simple, but heavily annotated,
-examples.</p>
+<p>See <directive module="mod_rewrite">RewriteMap</directive>.</p>
 </section>
 
 <section id="htaccess"><title>.htaccess files</title>
-<p>Discussion of the differences between rewrite rules in httpd.conf and
-in .htaccess files.</p>
-</section>
-
-<section id="EnvVar"><title>Environment Variables</title>
 
-<p>This module keeps track of two additional (non-standard)
-CGI/SSI environment variables named <code>SCRIPT_URL</code>
-and <code>SCRIPT_URI</code>. These contain the
-<em>logical</em> Web-view to the current resource, while the
-standard CGI/SSI variables <code>SCRIPT_NAME</code> and
-<code>SCRIPT_FILENAME</code> contain the <em>physical</em>
-System-view. </p>
-
-<p>Notice: These variables hold the URI/URL <em>as they were
-initially requested</em>, <em>i.e.</em>, <em>before</em> any
-rewriting. This is important because the rewriting process is
-primarily used to rewrite logical URLs to physical
-pathnames.</p>
-
-<example><title>Example</title>
-<pre>
-SCRIPT_NAME=/sw/lib/w3s/tree/global/u/rse/.www/index.html
-SCRIPT_FILENAME=/u/rse/.www/index.html
-SCRIPT_URL=/u/rse/
-SCRIPT_URI=http://en1.engelschall.com/u/rse/
-</pre>
-</example>
+<p>Rewriting is typically configured in the main server configuration
+setting (outside any <directive type="section"
+module="core">Directory</directive> section) or
+inside <directive type="section" module="core">VirtualHost</directive>
+containers. This is the easiest way to do rewriting and is
+recommended. It is possible, however, to do rewriting
+inside <directive type="section" module="core">Directory</directive>
+sections or <a href="../howto/htaccess.html"><code>.htaccess</code>
+files</a> at the expense of some additional complexity. This technique
+is called per-directory rewrites.</p>
+
+<p>The main difference with per-directory rewrites is that the path
+prefix of the directory containing the <code>.htaccess</code> file is
+stripped before matching in
+the <directive module="mod_rewrite">RewriteRule</directive>. In addition, the <directive module="mod_rewrite">RewriteBase</directive> should be used to assure the request is properly mapped.</p>
 
 </section>
 

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.html.en?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.html.en (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.html.en Wed Mar 12 08:53:58 2008
@@ -29,9 +29,9 @@
 <li><img alt="" src="../images/down.gif" /> <a href="#InternalRuleset">Ruleset Processing</a></li>
 </ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module
 documentation</a></li><li><a href="rewrite_intro.html">mod_rewrite
-introduction</a></li><li><a href="rewrite_guide.html">Practical solutions to common
-problems</a></li><li><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></li></ul></div>
+introduction</a></li><li><a href="rewrite_guide.html">Rewrite Guide - useful 
+examples</a></li><li><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide -
+advanced useful examples</a></li></ul></div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="Internal" id="Internal">Internal Processing</a></h2>

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.xml?rev=636379&r1=636378&r2=636379&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_tech.xml Wed Mar 12 08:53:58 2008
@@ -33,10 +33,10 @@
 documentation</a></seealso>
 <seealso><a href="rewrite_intro.html">mod_rewrite
 introduction</a></seealso>
-<seealso><a href="rewrite_guide.html">Practical solutions to common
-problems</a></seealso>
-<seealso><a href="rewrite_guide_advanced.html">Practical solutions to
-advanced problems</a></seealso>
+<seealso><a href="rewrite_guide.html">Rewrite Guide - useful 
+examples</a></seealso>
+<seealso><a href="rewrite_guide_advanced.html">Advanced Rewrite Guide -
+advanced useful examples</a></seealso>
 
 <section id="Internal"><title>Internal Processing</title>