Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by noodl: http://wiki.apache.org/httpd/RewriteContext The comment on the change is: Minor language changes ------------------------------------------------------------------------------ ## page was renamed from Rewrite/Context == Introduction == - The Apache HTTPD Server deals with requests in discrete phases. While this is usually transparent to the user and administrator it does have an effect on the behaviour of mod_rewrite when rulesets are placed in different contexts. To oversimplify a little, when rules are placed in !VirtualHost blocks (or in the main server context) they "run" before the server has yet mapped the requested URI to a filesystem path. Conversely, when rules are placed in .htaccess files, or in Directory blocks in the main server config, they "run" after this phase has occured. + The Apache HTTPD Server deals with requests in discrete phases. While this is usually transparent to the user and administrator it does have an effect on the behaviour of mod_rewrite when rulesets are placed in different contexts. To oversimplify a little, when rules are placed in !VirtualHost blocks (or in the main server context) they get evaluated before the server has yet mapped the requested URI to a filesystem path. Conversely, when rules are placed in .htaccess files, or in Directory blocks in the main server config, they are evaluated after this phase has occured. This timing issue affects two areas of rewrite rule construction, the base URI as seen by !RewriteRule and the values of certain environment variables. See the note entitled "Per-directory Rewrites" [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule here] for further details. @@ -27, +27 @@ == Environment Variables == - As discussed, in !VirtualHost (per-server) context, rewrite rules run before the request has been mapped to a filesystem path. Resulting from this, certain of the variables available to mod_rewrite concerned with filesystem paths are incomplete, including SCRIPT_FILENAME (and its mirror, REQUEST_FILENAME). + As mentioned, in !VirtualHost (per-server) context, rewrite rules run before the request has been mapped to a filesystem path. Resulting from this, certain of the variables available to mod_rewrite concerned with filesystem paths are incomplete, including SCRIPT_FILENAME (and its mirror, REQUEST_FILENAME). As an example, the following two rulesets attempt to see if the request uri corresponds to an existing file and take action if not.
