From 553f870f2d2fa8c6e696f05f4b1fef31487a07ee Mon Sep 17 00:00:00 2001
From: Rich Bowen
mod_rewrite acts in two of these phases (or "hooks", as they are often called) to influence how URLs may be rewritten.
@@ -44,39 +44,39 @@ and URL matching.First, it uses the URL-to-filename translation hook, which occurs
after the HTTP request has been read, but before any authorization
starts. Secondly, it uses the Fixup hook, which is after the
- authorizatin phases, and after per-directory configuration files
+ authorization phases, and after per-directory configuration files
(.htaccess
files) have been read, but before the
content handler is called.
So, after a request comes in and a corresponding server or
virtual host has been determined, the rewriting engine starts
processing any mod_rewrite
directives appearing in the
- per-server configuration. (ie, in the main server configuration file
+ per-server configuration. (i.e., in the main server configuration file
and <Virtualhost>
sections.) This happens in the URL-to-filename phase.
A few steps later, when the finaly data directories are found, +
A few steps later, once the final data directories have been found,
the per-directory configuration directives (.htaccess
files and <Directory>
blocks) are applied. This
happens in the Fixup phase.
In each of these cases, mod_rewrite rewrites the
- REQUEST_URI
either to a new URI, or to a filename.
REQUEST_URI
either to a new URL, or to a filename.
In per-directory context (ie, within .htaccess
files
and Directory
blocks), these rules are being applied
- after a URI has already been translated to a filename. Because of
- this, mod_rewrite temporarily translates the filename back into a URI,
- by stripping off directory paty before appling the rules. (See the
+ after a URL has already been translated to a filename. Because of
+ this, mod_rewrite temporarily translates the filename back into a URL,
+ by stripping off directory path before appling the rules. (See the
RewriteBase
directive to
see how you can further manipulate how this is handled.) Then, a new
- internal subrequest is issued with the new URI. This restarts
+ internal subrequest is issued with the new URL. This restarts
processing of the API phases.
Because of this further manipulation of the URI in per-directory +
Because of this further manipulation of the URL in per-directory context, you'll need to take care to craft your rewrite rules differently in that context. In particular, remember that the - leading directory path will be stripped off of the URI that your + leading directory path will be stripped off of the URL that your rewrite rules will see. Consider the examples below for further clarification.
@@ -104,7 +104,7 @@ and URL matching. -For even more insight into how mod_rewrite manipulates URIs in +
For even more insight into how mod_rewrite manipulates URLs in different contexts, you should consult the log entries made during rewriting.
@@ -121,7 +121,7 @@ and URL matching. rules together with their conditions). The operation of the URL rewriting engine itself is exactly the same for both configuration contexts. Only the final result processing is - different. + different.The order of rules in the ruleset is important because the rewriting engine processes them in a special (and not very -- cgit v1.2.3