diff options
author | Arno Töll <debian@toell.net> | 2012-01-08 22:53:17 +0100 |
---|---|---|
committer | Arno Töll <debian@toell.net> | 2012-01-08 22:53:17 +0100 |
commit | e072a2dd866b7cb9f14319b80326a4e7fd16fcdf (patch) | |
tree | a49dfc56d94a26011fe157835ff6cbe14edbd8a9 /docs/manual/rewrite/advanced.html.en | |
parent | 0890390c00801651d08d3794e13b31a5dabbf5ef (diff) | |
download | apache2-e072a2dd866b7cb9f14319b80326a4e7fd16fcdf.tar.gz |
Imported Upstream version 2.3.16-beta
Diffstat (limited to 'docs/manual/rewrite/advanced.html.en')
-rw-r--r-- | docs/manual/rewrite/advanced.html.en | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/docs/manual/rewrite/advanced.html.en b/docs/manual/rewrite/advanced.html.en index c0602748..a09dc0c3 100644 --- a/docs/manual/rewrite/advanced.html.en +++ b/docs/manual/rewrite/advanced.html.en @@ -12,19 +12,19 @@ <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> +<p class="apache">Apache HTTP Server Version 2.3</p> <img alt="" src="../images/feather.gif" /></div> <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div> <div id="path"> -<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Rewrite</a></div><div id="page-content"><div id="preamble"><h1>Advanced Techniques with mod_rewrite</h1> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Rewrite</a></div><div id="page-content"><div id="preamble"><h1>Advanced Techniques with mod_rewrite</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/rewrite/avoid.html" title="English"> en </a></p> </div> -<p>This document supplements the <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> -<a href="../mod/mod_rewrite.html">reference documentation</a>. It provides -a few advanced techniques and tricks using mod_rewrite.</p> +<p>This document supplements the <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> +<a href="../mod/mod_rewrite.html">reference documentation</a>. It provides +a few advanced techniques using mod_rewrite.</p> <div class="warning">Note that many of these examples won't work unchanged in your particular server configuration, so it's important that you understand @@ -51,8 +51,8 @@ configuration.</div> <dt>Description:</dt> <dd> - <p>A common technique for distributing the burden of - server load or storage space is called "sharding". + <p>A common technique for distributing the burden of + server load or storage space is called "sharding". When using this method, a front-end server will use the url to consistently "shard" users or objects to separate backend servers.</p> @@ -98,6 +98,9 @@ RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hos </dd> </dl> + <p>See the <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code> + documentation for more discussion of the syntax of this directive.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> <h2><a name="on-the-fly-content" id="on-the-fly-content">On-the-fly Content-Regeneration</a></h2> @@ -122,20 +125,22 @@ RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hos <div class="example"><p><code> # This example is valid in per-directory context only<br /> -RewriteCond %{REQUEST_FILENAME} <strong>!-s</strong><br /> -RewriteRule ^page\.<strong>html</strong>$ page.<strong>cgi</strong> [T=application/x-httpd-cgi,L] +RewriteCond %{REQUEST_URI} <strong>!-U</strong><br /> +RewriteRule ^(.+)\.html$ /regenerate_page.cgi [PT,L] </code></p></div> - <p>Here a request for <code>page.html</code> leads to an - internal run of a corresponding <code>page.cgi</code> if - <code>page.html</code> is missing or has filesize - null. The trick here is that <code>page.cgi</code> is a - CGI script which (additionally to its <code>STDOUT</code>) - writes its output to the file <code>page.html</code>. - Once it has completed, the server sends out - <code>page.html</code>. When the webmaster wants to force - a refresh of the contents, he just removes - <code>page.html</code> (typically from <code>cron</code>).</p> + <p>The <code>-U</code> operator determines whether the test string + (in this case, <code>REQUEST_URI</code>) is a valid URL. It does + this via a subrequest. In the event that this subrequest fails - + that is, the requested resource doesn't exist - this rule invokes + the CGI program <code>/regenerate_page.cgi</code>, which generates + the requested resource and saves it into the document directory, so + that the next time it is requested, a static copy can be served.</p> + + <p>In this way, documents that are infrequently updated can be served in + static form. if documents need to be refreshed, they can be deleted + from the document directory, and they will then be regenerated the + next time they are requested.</p> </dd> </dl> @@ -193,6 +198,8 @@ featureful than anything you can cobble together using mod_rewrite.</p> + + <dl> <dt>Description:</dt> @@ -396,7 +403,7 @@ RewriteRule ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*) /home/<strong>$2</stro </dd> <dt>Discussion:</dt> - <dd>This technique will of course also work with other + <dd>This technique will of course also work with other special characters that mod_rewrite, by default, URL-encodes.</dd> </dl> @@ -480,6 +487,10 @@ RewriteRule ^/horse/(.*) /pony/$1 [E=<strong>rewritten:1</strong>] RewriteCond %{ENV:rewritten} =1 </code></p></div> + <p>Note that environment variables do not survive an external + redirect. You might consider using the [CO] flag to set a + cookie.</p> + </dd> </dl> |