From 514827929b82a42cf3930d1b60cc69ca0bd24dc4 Mon Sep 17 00:00:00 2001 From: Eric Covener <covener@apache.org> Date: Sun, 22 Nov 2009 01:38:59 +0000 Subject: [PATCH] continue clarification of RewriteBase, lots of users who install little 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 | 16 +++++++++++----- docs/manual/mod/mod_rewrite.xml | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/docs/manual/mod/mod_rewrite.html.en b/docs/manual/mod/mod_rewrite.html.en index c5ca76b812..f85450c3cd 100644 --- a/docs/manual/mod/mod_rewrite.html.en +++ b/docs/manual/mod/mod_rewrite.html.en @@ -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> diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index ce368f6761..363429ddb2 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -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> -- 2.40.0