continue clarification of RewriteBase, lots of users who install little
authorEric Covener <covener@apache.org>
Sun, 22 Nov 2009 01:38:59 +0000 (01:38 +0000)
committerEric Covener <covener@apache.org>
Sun, 22 Nov 2009 01:38:59 +0000 (01:38 +0000)
PHP apps with an Alias a) leave off RewriteBase then b) add the filesystem
path instead of the URL-path then c) spend hours trying to debug
the RewriteRules themselves.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@883030 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_rewrite.html.en
docs/manual/mod/mod_rewrite.xml

index c5ca76b8124b8df26b536499139cc36fcc80b6fb..f85450c3cd1dad0269e426b108c6d29dea2bebcc 100644 (file)
@@ -78,26 +78,32 @@ URLs on the fly</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.
+      sets the base URL-path (not filesystem directory path!)  for per-directory rewrites.
       When you use a <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
       in a <code>.htaccess</code> file, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> strips off
       the local directory prefix before processing, then rewrites the rest of 
       the URL. When the rewrite is completed, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
       automatically adds the local directory prefix back on to the path.</p>
       
-      <p>If your URL path does not exist on the filesystem,
+      <p>This directive is <em>required</em> for per-directory rewrites whose context
+      is a directory made available via the <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>
+      directive.</p>
+
+      <p>If your URL path does not exist verbatim on the filesystem,
+      or isn't directly under your <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>,
       you must 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.  </p>
+      <code>.htaccess</code> file where you want to use <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives.</p>
 
       <p>The example below demonstrates how to map 
-      <code>http://example.com/foo/index.html</code> to 
+      <code>http://example.com/myapp/index.html</code> to 
       <code>/home/www/example/newsite.html</code>, in a <code>.htaccess</code> 
       file. This assumes that the content available at
       <code>http://example.com/</code> is on disk at 
       <code>/home/www/example/</code>.</p>
 <div class="example"><pre>
 RewriteEngine On
-RewriteBase /foo/
+# The URL-path used to get to this context, not the filesystem path
+RewriteBase /myapp/
 RewriteRule ^index\.html$  newsite.html
 </pre></div>
 
index ce368f676181b9126ee0876db655a0b8e34661e4..363429ddb20535fd030e49d49b96d893136148f1 100644 (file)
@@ -503,20 +503,25 @@ once!
 
 <usage>
       <p>The <directive>RewriteBase</directive> directive explicitly
-      sets the base URL for per-directory rewrites.
+      sets the base URL-path (not filesystem directory path!)  for per-directory rewrites.
       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 back on to the path.</p>
       
-      <p>If your URL path does not exist on the filesystem,
+      <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.</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>
+      module="mod_rewrite">RewriteRule</directive> directives.</p>
 
       <p>The example below demonstrates how to map 
-      <code>http://example.com/foo/index.html</code> to 
+      <code>http://example.com/myapp/index.html</code> to 
       <code>/home/www/example/newsite.html</code>, in a <code>.htaccess</code> 
       file. This assumes that the content available at
       <code>http://example.com/</code> is on disk at 
@@ -524,7 +529,8 @@ once!
 <example>
 <pre>
 RewriteEngine On
-RewriteBase /foo/
+# The URL-path used to get to this context, not the filesystem path
+RewriteBase /myapp/
 RewriteRule ^index\.html$  newsite.html
 </pre>
 </example>