Commit 2f066356 authored by Eric Covener's avatar Eric Covener
Browse files

xforms


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1308348 13f79535-47bb-0310-9956-ffa450edef68
parent 0588b736
Loading
Loading
Loading
Loading
+30 −75
Original line number Diff line number Diff line
@@ -140,91 +140,46 @@ SCRIPT_URI=http://en1.engelschall.com/u/rse/
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the base URL for per-directory rewrites</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteBase <em>URL-path</em></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for information.</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>None</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
</table>
      <p>The <code class="directive">RewriteBase</code> directive explicitly
      sets the base URL for per-directory rewrites. As you will see
      below, <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
      can be used in per-directory config files
      (<code>.htaccess</code>). In such a case, it will act locally,
      stripping the local directory prefix before processing, and applying
      rewrite rules only to the remainder. When processing is complete, the 
      prefix is automatically added back to the
      path. The default setting is; <code class="directive">RewriteBase</code> <em>physical-directory-path</em></p>

      <p>When a substitution occurs for a new URL, this module has
      to re-inject the URL into the server processing. To be able
      to do this it needs to know what the corresponding URL-prefix
      or URL-base is. By default this prefix is the corresponding
      filepath itself. <strong>However, for most websites, URLs are NOT
      directly related to physical filename paths, so this
      assumption will often be wrong!</strong> Therefore, you can 
      use the <code>RewriteBase</code> directive to specify the
      correct URL-prefix.</p>

<div class="note"> If your webserver's URLs are <strong>not</strong> directly
related to physical file paths, you will need to use
<code class="directive">RewriteBase</code> in every <code>.htaccess</code>
file where you want to use <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives.
</div>

        <p> For example, assume the following per-directory config file:</p>
      <p>The <code class="directive">RewriteBase</code> directive specifies the
      URL prefix to be used for per-directory (htaccess) 
      <code class="directive">RewriteRule</code> 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:
      <ul>
          <li> The original request, and the substitution, are underneath the 
               <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>
               (as opposed to reachable by other means, such as 
               <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>).</li>
          <li> The <em>filesystem</em> path to the directory containing the
               <code class="directive">RewriteRule</code>, suffixed by the relative 
               substitution is also valid as a URL path on the server 
               (this is rare).</li>
      </ul>
      </p>

<p> In the example below, <code class="directive">RewriteBase</code> 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 
    misconfiguration would normally cause the server to look for an "opt"
    directory under the document root.</p>
<div class="example"><pre>
#
#  /abc/def/.htaccess -- per-dir config file for directory /abc/def
#  Remember: /abc/def is the physical path of /xyz, <em>i.e.</em>, the server
#            has a 'Alias /xyz /abc/def' directive <em>e.g.</em>
#

DocumentRoot /var/www/example.com
Alias /myapp /opt/myapp-1.2.3
&lt;Directory /opt/myapp-1.2.3&gt;
RewriteEngine On

#  let the server know that we were reached via /xyz and not
#  via the physical path prefix /abc/def
RewriteBase   /xyz

#  now the rewriting rules
RewriteRule   ^oldstuff\.html$  newstuff.html
RewriteBase /myapp/
RewriteRule ^index\.html$  welcome.html 
&lt;/Directory&gt;
</pre></div>

        <p>In the above example, a request to
        <code>/xyz/oldstuff.html</code> gets correctly rewritten to
        the physical file <code>/abc/def/newstuff.html</code>.</p>

<div class="note"><h3>For Apache Hackers</h3>
<p>The following list gives detailed information about
              the internal processing steps:</p>
<pre>
Request:
  /xyz/oldstuff.html

Internal Processing:
  /xyz/oldstuff.html     -&gt; /abc/def/oldstuff.html  (per-server Alias)
  /abc/def/oldstuff.html -&gt; /abc/def/newstuff.html  (per-dir    RewriteRule)
  /abc/def/newstuff.html -&gt; /xyz/newstuff.html      (per-dir    RewriteBase)
  /xyz/newstuff.html     -&gt; /abc/def/newstuff.html  (per-server Alias)

Result:
  /abc/def/newstuff.html
</pre>
              <p>This seems very complicated, but is in fact
              correct Apache internal processing. Because the
              per-directory rewriting comes late in the
              process, the rewritten request
              has to be re-injected into the Apache kernel, as if it
              were a new request. (See <a href="../rewrite/tech.html">mod_rewrite technical
              details</a>.)
              This is not the serious overhead it may seem to be - 
              this re-injection is completely internal to the 
	      Apache server (and the same procedure is used by 
	      many other operations within Apache).</p> 
</div>


</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a></h2>
+13 −52
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#output">Description of output</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#bugs">Bugs</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#output">Example Output</a></li>
</ul><h3>See also</h3><ul class="seealso"><li><code class="program"><a href="../programs/httpd.html">httpd</a></code></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
@@ -203,57 +203,7 @@
    </dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="bugs" id="bugs">Bugs</a></h2>
    <p>There are various statically declared buffers of fixed length. Combined
    with the lazy parsing of the command line arguments, the response headers
    from the server and other external inputs, this might bite you.</p>

    <p>It does not implement HTTP/1.x fully; only accepts some 'expected' forms
    of responses. The rather heavy use of <code>strstr(3)</code> shows up top
    in profile, which might indicate a performance problem; <em>i.e.</em>, you
    would measure the <code>ab</code> performance rather than the server's.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="output" id="output">Example Output</a></h2>

    <p>Sample output is provided here.</p>
    <div class="note"><pre>Server Software:        Apache/2.2.17
Server Hostname:        testserver.com
Server Port:            80

Document Path:          /index.html
Document Length:        787 bytes

Concurrency Level:      5
Time taken for tests:   0.436 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      1026000 bytes
HTML transferred:       787000 bytes
Requests per second:    2292.26 [#/sec] (mean)
Time per request:       2.181 [ms] (mean)
Time per request:       0.436 [ms] (mean, across all concurrent requests)
Transfer rate:          2296.74 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.4      1       3
Processing:     1    1   0.4      1       3
Waiting:        0    1   0.5      1       2
Total:          2    2   0.1      2       3

Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      2
  80%      2
  90%      2
  95%      2
  98%      2
  99%      3
 100%      3 (longest request)</pre></div>

<h2><a name="output" id="output">Description of output</a></h2>
    <p>The output may vary depending on the command line parameters given.
    Possible output with a brief explanation of each element is listed below.
    </p>
@@ -338,6 +288,17 @@ Percentage of the requests served within a certain time (ms)
        <dd>The rate of transfer as calculated by the formula
        <code>totalread / 1024 / timetaken</code></dd>
    </dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="bugs" id="bugs">Bugs</a></h2>
    <p>There are various statically declared buffers of fixed length. Combined
    with the lazy parsing of the command line arguments, the response headers
    from the server and other external inputs, this might bite you.</p>

    <p>It does not implement HTTP/1.x fully; only accepts some 'expected' forms
    of responses. The rather heavy use of <code>strstr(3)</code> shows up top
    in profile, which might indicate a performance problem; <em>i.e.</em>, you
    would measure the <code>ab</code> performance rather than the server's.</p>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../en/programs/ab.html" title="English">&nbsp;en&nbsp;</a> |