httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r1308320 - /httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
Date Mon, 02 Apr 2012 12:37:32 GMT
Author: covener
Date: Mon Apr  2 12:37:32 2012
New Revision: 1308320

PR51969: one more try at explaining RewriteBase, simplify the example and show
how missing rewritebase altogether would go wrong.


Modified: httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
--- httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml Mon Apr  2 12:37:32 2012
@@ -293,42 +293,41 @@ Apache HTTP Server 2.0.41 and later</com
-      <p>The <directive>RewriteBase</directive> directive explicitly
-      sets the base URL-path (not filesystem directory path!)  for per-directory rewrites
-      that result in the substitution of a relative path.
-      When you use a <directive module="mod_rewrite">RewriteRule</directive>
-      in a <code>.htaccess</code> file, <module>mod_rewrite</module>
strips off
-      the local directory prefix before processing, then rewrites the rest of
-      the URL. When the rewrite is completed, <module>mod_rewrite</module>
-      automatically adds the local directory prefix (or the
-      <directive>RewriteBase</directive> when set) back on to the substitution
-      before handing it back to the core of the server as if it were the original
-      URL.</p>
-      <p>This directive is <em>required</em> for per-directory rewrites
whose context
-      is a directory made available via the <directive module="mod_alias">Alias</directive>
-      directive, when the substitution uses a relative path.</p>
-      <p>If your URL path does not exist verbatim on the filesystem,
-      or isn't directly under your <directive module="core">DocumentRoot</directive>,
-      you must use <directive>RewriteBase</directive> in every
-      <code>.htaccess</code> file where you want to use <directive
-      module="mod_rewrite">RewriteRule</directive> directives.</p>
-      <p>The example below demonstrates how to map
- to
-      /home/www/example/newsite.html, in a <code>.htaccess</code> file. This
-      assumes that the content available at
- is on disk at /home/www/example/</p>
+      <p>The <directive>RewriteBase</directive> directive specifies the
+      URL prefix to be used for per-directory (htaccess) 
+      <directive>RewriteRule</directive> 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 
+               <directive module="core">DocumentRoot</directive>
+               (as opposed to reachable by other means, such as 
+               <directive module="mod_alias">Alias</directive>).</li>
+          <li> The <em>filesystem</em> path to the directory containing
+               <directive>RewriteRule</directive>, 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, <directive>RewriteBase</directive> is necessary
+    to avoid rewriting to
+    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>
+DocumentRoot /var/www/
+Alias /myapp /opt/myapp-1.2.3
+&lt;Directory /opt/myapp-1.2.3&gt;
 RewriteEngine On
-# The URL-path used to get to this context, not the filesystem path
 RewriteBase /myapp/
-RewriteRule ^index\.html$  newsite.html
+RewriteRule ^index\.html$  welcome.html 

View raw message