From: Eric Covener Date: Sun, 22 Nov 2009 01:38:59 +0000 (+0000) Subject: continue clarification of RewriteBase, lots of users who install little X-Git-Tag: 2.3.4~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=514827929b82a42cf3930d1b60cc69ca0bd24dc4;p=apache 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 --- 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 Module:mod_rewrite

The RewriteBase 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 RewriteRule in a .htaccess file, mod_rewrite strips off the local directory prefix before processing, then rewrites the rest of the URL. When the rewrite is completed, mod_rewrite automatically adds the local directory prefix back on to the path.

-

If your URL path does not exist on the filesystem, +

This directive is required for per-directory rewrites whose context + is a directory made available via the Alias + directive.

+ +

If your URL path does not exist verbatim on the filesystem, + or isn't directly under your DocumentRoot, you must use RewriteBase in every - .htaccess file where you want to use RewriteRule directives.

+ .htaccess file where you want to use RewriteRule directives.

The example below demonstrates how to map - http://example.com/foo/index.html to + http://example.com/myapp/index.html to /home/www/example/newsite.html, in a .htaccess file. This assumes that the content available at http://example.com/ is on disk at /home/www/example/.

 RewriteEngine On
-RewriteBase /foo/
+# The URL-path used to get to this context, not the filesystem path
+RewriteBase /myapp/
 RewriteRule ^index\.html$  newsite.html
 
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!

The RewriteBase 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 RewriteRule in a .htaccess file, mod_rewrite strips off the local directory prefix before processing, then rewrites the rest of the URL. When the rewrite is completed, mod_rewrite automatically adds the local directory prefix back on to the path.

-

If your URL path does not exist on the filesystem, +

This directive is required for per-directory rewrites whose context + is a directory made available via the Alias + directive.

+ +

If your URL path does not exist verbatim on the filesystem, + or isn't directly under your DocumentRoot, you must use RewriteBase in every .htaccess file where you want to use RewriteRule directives.

+ module="mod_rewrite">RewriteRule directives.

The example below demonstrates how to map - http://example.com/foo/index.html to + http://example.com/myapp/index.html to /home/www/example/newsite.html, in a .htaccess file. This assumes that the content available at http://example.com/ is on disk at @@ -524,7 +529,8 @@ once!

 RewriteEngine On
-RewriteBase /foo/
+# The URL-path used to get to this context, not the filesystem path
+RewriteBase /myapp/
 RewriteRule ^index\.html$  newsite.html