From 6bda4890a2f3b84cc632993120a9d617c3660b13 Mon Sep 17 00:00:00 2001 From: Noirin Plunkett Date: Tue, 3 Nov 2009 01:09:38 +0000 Subject: [PATCH] Removing more cruft, rewriting what's left git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832239 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/mod_rewrite.html.en | 93 ++++++---------------------- docs/manual/mod/mod_rewrite.xml | 96 ++++++----------------------- 2 files changed, 39 insertions(+), 150 deletions(-) diff --git a/docs/manual/mod/mod_rewrite.html.en b/docs/manual/mod/mod_rewrite.html.en index 991fd295bf..11f543538f 100644 --- a/docs/manual/mod/mod_rewrite.html.en +++ b/docs/manual/mod/mod_rewrite.html.en @@ -71,90 +71,35 @@ URLs on the fly - +
Description:Sets the base URL for per-directory rewrites
Syntax:RewriteBase URL-path
Default:See usage for information.
Default:None
Context:directory, .htaccess
Override:FileInfo
Status:Extension
Module:mod_rewrite

The RewriteBase directive explicitly - sets the base URL for per-directory rewrites. As you will see - below, RewriteRule - can be used in per-directory config files - (.htaccess). 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; RewriteBase physical-directory-path

- -

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. However, for most websites, URLs are NOT - directly related to physical filename paths, so this - assumption will often be wrong! Therefore, you can - use the RewriteBase directive to specify the - correct URL-prefix.

- -
If your webserver's URLs are not directly -related to physical file paths, you will need to use -RewriteBase in every .htaccess -file where you want to use RewriteRule directives. -
- -

For example, assume the following per-directory config file:

- + sets the base URL 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, + you must use RewriteBase in every + .htaccess file where you want to use RewriteRule directives.

+ +

The example below demonstrates how to map + http://example.com/foo/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/

-#
-#  /abc/def/.htaccess -- per-dir config file for directory /abc/def
-#  Remember: /abc/def is the physical path of /xyz, i.e., the server
-#            has a 'Alias /xyz /abc/def' directive e.g.
-#
-
 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 /foo/
+RewriteRule ^index\.html$  newsite.html
 
-

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

- -

For Apache Hackers

-

The following list gives detailed information about - the internal processing steps:

-
-Request:
-  /xyz/oldstuff.html
-
-Internal Processing:
-  /xyz/oldstuff.html     -> /abc/def/oldstuff.html  (per-server Alias)
-  /abc/def/oldstuff.html -> /abc/def/newstuff.html  (per-dir    RewriteRule)
-  /abc/def/newstuff.html -> /xyz/newstuff.html      (per-dir    RewriteBase)
-  /xyz/newstuff.html     -> /abc/def/newstuff.html  (per-server Alias)
-
-Result:
-  /abc/def/newstuff.html
-
-

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 mod_rewrite technical - details.) - 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).

-
-
top
diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index 081d9faf69..362d0d920d 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -496,94 +496,38 @@ once! RewriteBase Sets the base URL for per-directory rewrites RewriteBase URL-path -See usage for information. +None directory.htaccess FileInfo

The RewriteBase directive explicitly - sets the base URL for per-directory rewrites. As you will see - below, RewriteRule - can be used in per-directory config files - (.htaccess). 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; RewriteBase physical-directory-path

- -

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. However, for most websites, URLs are NOT - directly related to physical filename paths, so this - assumption will often be wrong! Therefore, you can - use the RewriteBase directive to specify the - correct URL-prefix.

- - If your webserver's URLs are not directly -related to physical file paths, you will need to use -RewriteBase in every .htaccess -file where you want to use RewriteRule directives. - - -

For example, assume the following per-directory config file:

- + sets the base URL 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, + you must use RewriteBase in every + .htaccess file where you want to use RewriteRule directives.

+ +

The example below demonstrates how to map + http://example.com/foo/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/

-#
-#  /abc/def/.htaccess -- per-dir config file for directory /abc/def
-#  Remember: /abc/def is the physical path of /xyz, i.e., the server
-#            has a 'Alias /xyz /abc/def' directive e.g.
-#
-
 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 /foo/
+RewriteRule ^index\.html$  newsite.html
 
-

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

- -For Apache Hackers -

The following list gives detailed information about - the internal processing steps:

-
-Request:
-  /xyz/oldstuff.html
-
-Internal Processing:
-  /xyz/oldstuff.html     -> /abc/def/oldstuff.html  (per-server Alias)
-  /abc/def/oldstuff.html -> /abc/def/newstuff.html  (per-dir    RewriteRule)
-  /abc/def/newstuff.html -> /xyz/newstuff.html      (per-dir    RewriteBase)
-  /xyz/newstuff.html     -> /abc/def/newstuff.html  (per-server Alias)
-
-Result:
-  /abc/def/newstuff.html
-
-

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 mod_rewrite technical - details.) - 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).

-
-
-- 2.40.0