From: Ralf S. Engelschall Date: Tue, 10 Mar 1998 13:37:27 +0000 (+0000) Subject: Phase 2 of mod_rewrite documentation enhancement: X-Git-Tag: APACHE_BIG_SYMBOL_RENAME_POST~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=716820ac750fa7a317a84ac3fca0d48e24ddc611;p=apache Phase 2 of mod_rewrite documentation enhancement: Cleanup of the HTML markup code (Thanks to Marc and Martin for hints) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@80466 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_rewrite.html b/docs/manual/mod/mod_rewrite.html index 5b239d8271..fe54a2bc22 100644 --- a/docs/manual/mod/mod_rewrite.html +++ b/docs/manual/mod/mod_rewrite.html @@ -15,7 +15,7 @@ VLINK="#000080" ALINK="#FF0000" > -
+

@@ -30,6 +30,7 @@ build Configuration file: AddModule modules/standard/mod_rewrite.o +



@@ -38,7 +39,7 @@ build Configuration file:
-,,The great thing about mod_rewrite is it gives you all the +``The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail.'' @@ -72,16 +73,19 @@ redirection or even to an internal proxy throughput.

But all this functionality and flexibility has its drawback: complexity. So don't expect to understand this module in it's whole in just one day. +

This module was invented and originally written in April 1996
and gifted exclusively to the The Apache Group in July 1997 by +

- Ralf S. Engelschall
- rse@engelschall.com
- www.engelschall.com +Ralf S. Engelschall
+rse@engelschall.com
+www.engelschall.com
+


Table Of Contents

@@ -112,12 +116,14 @@ and gifted exclusively to the The Apache Group in July 1997 by
  • Practical Solutions +


    Internal Processing

    +


    @@ -205,17 +211,19 @@ Figure 1 for more details.

    - - - - - - - -
    [Needs graphics capability to display]
    -Figure 1: The control flow through the rewriting ruleset -
    + + + + + + + +
    [Needs graphics capability to display]
    +Figure 1: The control flow through the rewriting ruleset +

    @@ -247,17 +255,19 @@ transfered to for expansion.

    - - - - - - - -
    [Needs graphics capability to display]
    -Figure 2: The back-reference flow through a rule -
    + + + + + + + +
    [Needs graphics capability to display]
    +Figure 2: The back-reference flow through a rule +

    @@ -272,6 +282,7 @@ of the available directives.

    Configuration Directives

    +


    RewriteEngine

    @@ -289,22 +300,22 @@ of the available directives. >Context: server config, virtual host, per-directory config

    -The RewriteEngine directive enables or disables the -runtime rewriting engine. If it is set to off this module does -no runtime processing at all. It does not even update the SCRIPT_URx +The RewriteEngine directive enables or disables the runtime +rewriting engine. If it is set to off this module does no runtime +processing at all. It does not even update the SCRIPT_URx environment variables.

    Use this directive to disable the module instead of commenting out -all RewriteRule directives! +all RewriteRule directives!

    Note that, by default, rewrite configurations are not inherited. -This means that you need to have a RewriteEngine on +This means that you need to have a RewriteEngine on directive for each virtual host you wish to use it in.

    -


    +

    RewriteOptions

    @@ -322,7 +333,7 @@ directive for each virtual host you wish to use it in. >Context: server config, virtual host, per-directory config

    -The RewriteOptions directive sets some special options for the +The RewriteOptions directive sets some special options for the current per-server or per-directory configuration. The Option strings can be one of the following: @@ -332,11 +343,11 @@ strings can be one of the following: parent. In per-virtual-server context this means that the maps, conditions and rules of the main server gets inherited. In per-directory context this means that conditions and rules of the parent directory's - .htaccess configuration gets inherited. + .htaccess configuration gets inherited.

    -


    +

    RewriteLog

    @@ -354,14 +365,14 @@ strings can be one of the following: >Context: server config, virtual host

    -The RewriteLog directive sets the name of the file to which the +The RewriteLog directive sets the name of the file to which the server logs any rewriting actions it performs. If the name does not begin -with a slash ('/') then it is assumed to be relative to the +with a slash ('/') then it is assumed to be relative to the Server Root. The directive should occur only once per server config.

    - +
    Notice: To disable the logging of rewriting actions it is not recommended to set Filename @@ -370,12 +381,12 @@ not create output to a logfile it still creates the logfile output internally. This will slow down the server with no advantage to the administrator! To disable logging either remove or comment out the -RewriteLog directive or use RewriteLogLevel 0! +RewriteLog directive or use RewriteLogLevel 0!

    - +
    Security: See the Apache Security @@ -394,7 +405,7 @@ RewriteLog "/usr/local/var/apache/logs/rewrite.log"

    -


    +

    RewriteLogLevel

    @@ -410,9 +421,9 @@ RewriteLog "/usr/local/var/apache/logs/rewrite.log" HREF="directive-dict.html#Context" REL="Help" >Context: server config, virtual host
    -

    -The RewriteLogLevel directive set the verbosity level of the rewriting +

    +The RewriteLogLevel directive set the verbosity level of the rewriting logfile. The default level 0 means no logging, while 9 or more means that practically all actions are logged. @@ -421,7 +432,7 @@ To disable the logging of rewriting actions simply set Level to 0. This disables all rewrite action logs.

    - +
    Here the source is a Unix program, not a map file. To create it you can use the language of your choice, but the result has to be a run-able Unix executable (i.e. either object-code or a script with the - magic cookie trick '#!/path/to/interpreter' as the first line). + magic cookie trick '#!/path/to/interpreter' as the first line).

    This program gets started once at startup of the Apache servers and then - communicates with the rewriting engine over its stdin and - stdout file-handles. For each map-function lookup it will + communicates with the rewriting engine over its stdin and + stdout file-handles. For each map-function lookup it will receive the key to lookup as a newline-terminated string on - stdin. It then has to give back the looked-up value as a - newline-terminated string on stdout or the four-character string - ``NULL'' if it fails (i.e. there is no corresponding value + stdin. It then has to give back the looked-up value as a + newline-terminated string on stdout or the four-character string + ``NULL'' if it fails (i.e. there is no corresponding value for the given key). A trivial program which will implement a 1:1 map (i.e. key == value) could be:

    -

    Notice: Using a high value for Level will slow down your Apache server dramatically! Use the rewriting logfile only for debugging or at least @@ -439,7 +450,7 @@ RewriteLogLevel 3

    -


    +

    RewriteLock

    @@ -455,17 +466,16 @@ RewriteLogLevel 3 HREF="directive-dict.html#Context" REL="Help" >Context: server config, virtual host
    -

    +

    This directive sets the filename for a synchronization lockfile which mod_rewrite needs to communicate with RewriteMap programs. Set this lockfile to a local path (not on a NFS-mounted device) when you want to use a rewriting map-program. It is not required for -SAMP -using all other types of rewriting maps. +SAMP using all other types of rewriting maps.

    -


    +

    RewriteMap

    @@ -481,9 +491,9 @@ using all other types of rewriting maps. HREF="directive-dict.html#Context" REL="Help" >Context: server config, virtual host
    -

    -The RewriteMap directive defines a Rewriting Map +

    +The RewriteMap directive defines a Rewriting Map which can be used inside rule substitution strings by the mapping-functions to insert/substitute fields through a key lookup. The source of this lookup can be of various types. @@ -525,7 +535,7 @@ can be used:

    Example:

    - +
     ##
     ##  map.txt -- rewriting map
    @@ -537,7 +547,7 @@ Mr.Joe.Average        joe   # Mr. Average
     

    - +
    @@ -549,14 +559,14 @@ RewriteMap real-to-host txt:/path/to/file/map.txt

    This is identical to the Standard Plain Text variant above but with a special post-processing feature: After looking up a value it is parsed according - to contained ``|'' characters which have the meaning of ``or''. Or + to contained ``|'' characters which have the meaning of ``or''. Or in other words: they indicate a set of alternatives from which the actual returned value is choosen randomly. Although this sounds crazy and useless, it was actually designed for load balancing in a reverse proxy situation where the looked up values are server names. Example:

    -

     RewriteMap real-to-host txt:/path/to/file/map.txt
     
    +
     ##
     ##  map.txt -- rewriting map
    @@ -568,7 +578,7 @@ dynamic  www5|www6
     

    - +
    @@ -583,7 +593,7 @@ RewriteMap servers rnd:/path/to/file/map.txt which is optimized for really fast lookups. You can create such a file with any NDBM tool or with the following Perl script:

    -

     RewriteMap servers rnd:/path/to/file/map.txt
     
    +
     #!/path/to/bin/perl
     ##
    @@ -601,7 +611,7 @@ dbmclose(%DB);
     close(TXT)

    - +
    $ txt2dbm map.txt map.db 

    @@ -623,19 +633,19 @@ close(TXT)

    +
     #!/usr/bin/perl
     $| = 1;
    @@ -652,8 +662,8 @@ while (<STDIN>) {
         
  • ``Keep the program simple, stupid'' (KISS), because if this program hangs it will lead to a hang of the Apache server when the rule occurs. -
  • Avoid one common mistake: never do buffered I/O on stdout! - This will cause a deadloop! Hence the ``$|=1'' in the above +
  • Avoid one common mistake: never do buffered I/O on stdout! + This will cause a deadloop! Hence the ``$|=1'' in the above example...
  • Use the RewriteLock directive to define a lockfile mod_rewrite can use to synchronize the communication to the program. @@ -661,26 +671,25 @@ while (<STDIN>) { -The RewriteMap directive can occur more than once. For each -mapping-function use one RewriteMap directive to declare its +The RewriteMap directive can occur more than once. For each +mapping-function use one RewriteMap directive to declare its rewriting mapfile. While you cannot declare a map in per-directory context it is of course possible to use this map in per-directory context.

    - +
    Notice: For plain text and DBM format files the looked-up keys are cached in-core -until the mtime of the mapfile changes or the server does a +until the mtime of the mapfile changes or the server does a restart. This way you can have map-functions in rules which are used for every request. This is no problem, because the external lookup only happens once!
    -

    -


    +

    RewriteBase

    @@ -696,30 +705,30 @@ only happens once! HREF="directive-dict.html#Context" REL="Help" >Context: per-directory config
    -

    -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). There it will act +

    +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). There it will act locally, i.e. the local directory prefix is stripped at this stage of processing and your rewriting rules act only on the remainder. At the end it is automatically added.

    -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. But at most websites URLs are -NOT directly related to physical filename paths, so this assumption -will be usually be wrong! There you have to use the RewriteBase -directive to specify the correct URL-prefix. +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. But at most websites URLs are +NOT directly related to physical filename paths, so this +assumption will be usually be wrong! There you have to use the +RewriteBase directive to specify the correct URL-prefix.

    - +
    Notice: If your webserver's URLs are not directly -related to physical file paths, you have to use RewriteBase in every -.htaccess files where you want to use RewriteRule +related to physical file paths, you have to use RewriteBase in every +.htaccess files where you want to use RewriteRule directives.
    @@ -731,7 +740,7 @@ directives. Assume the following per-directory config file:

    - +
     #
     #  /abc/def/.htaccess -- per-dir config file for directory /abc/def
    @@ -751,13 +760,13 @@ RewriteRule   ^oldstuff\.html$  newstuff.html
     

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

    - +
    - + Notice - For the Apache hackers:
    The following list gives detailed information about the internal processing steps: @@ -792,7 +801,7 @@ sure the design and implementation is correct.

    -


    +

    RewriteCond

    @@ -808,10 +817,10 @@ sure the design and implementation is correct. HREF="directive-dict.html#Context" REL="Help" >Context: server config, virtual host, per-directory config
    -

    -The RewriteCond directive defines a rule condition. Precede a -RewriteRule directive with one or more RewriteCond +

    +The RewriteCond directive defines a rule condition. Precede a +RewriteRule directive with one or more RewriteCond directives. The following rewriting rule is only used if its pattern matches the current @@ -825,23 +834,24 @@ expanded constructs in addition to plain text:

  • RewriteRule backreferences: These are backreferences of the form
    -$N +$N
    (1 <= N <= 9) which provide access to the grouped parts (parenthesis!) of the -pattern from the corresponding RewriteRule directive (the one -following the current bunch of RewriteCond directives). +pattern from the corresponding RewriteRule directive (the one +following the current bunch of RewriteCond directives).

    -

  • RewriteCond backreferences: These are backreferences of the form +
  • RewriteCond backreferences: These are backreferences of +the form
    -%N +%N
    (1 <= N <= 9) which provide access to the grouped parts (parenthesis!) of the -pattern from the last matched RewriteCond directive in the current +pattern from the last matched RewriteCond directive in the current bunch of conditions.

    @@ -849,18 +859,18 @@ bunch of conditions. of the form

    -%{ NAME_OF_VARIABLE } +%{ NAME_OF_VARIABLE }
    where NAME_OF_VARIABLE can be a string of the following list:

    - +
    - - - - -
    + HTTP headers:

    - + HTTP_USER_AGENT
    HTTP_REFERER
    HTTP_COOKIE
    @@ -871,9 +881,9 @@ HTTP_ACCEPT

    + connection & request:

    - + REMOTE_ADDR
    REMOTE_HOST
    REMOTE_USER
    @@ -889,9 +899,9 @@ AUTH_TYPE

    + server internals:

    - + DOCUMENT_ROOT
    SERVER_ADMIN
    SERVER_NAME
    @@ -902,9 +912,9 @@ SERVER_VERSION

    + system stuff:

    - + TIME_YEAR
    TIME_MON
    TIME_DAY
    @@ -916,9 +926,9 @@ TIME

    + specials:

    - + API_VERSION
    THE_REQUEST
    REQUEST_URI
    @@ -930,10 +940,10 @@ IS_SUBREQ

    - +
    Notice: These variables all correspond to the similar named -HTTP MIME-headers, C variables of the Apache server or struct tm +HTTP MIME-headers, C variables of the Apache server or struct tm fields of the Unix system.
    @@ -942,43 +952,44 @@ fields of the Unix system.

    Special Notes: +

    1. The variables SCRIPT_FILENAME and REQUEST_FILENAME contain the same -value, i.e. the value of the filename field of the internal -request_rec structure of the Apache server. The first name is just the +value, i.e. the value of the filename field of the internal +request_rec structure of the Apache server. The first name is just the commonly known CGI variable name while the second is the consistent -counterpart to REQUEST_URI (which contains the value of the uri -field of request_rec). +counterpart to REQUEST_URI (which contains the value of the uri +field of request_rec).

      -

    2. There is the special format: %{ENV:variable} where +
    3. There is the special format: %{ENV:variable} where variable can be any environment variable. This is looked-up via -internal Apache structures and (if not found there) via getenv() from +internal Apache structures and (if not found there) via getenv() from the Apache server process.

      -

    4. There is the special format: %{HTTP:header} where +
    5. There is the special format: %{HTTP:header} where header can be any HTTP MIME-header name. This is looked-up -from the HTTP request. Example: %{HTTP:Proxy-Connection} -is the value of the HTTP header ``Proxy-Connection:''. +from the HTTP request. Example: %{HTTP:Proxy-Connection} +is the value of the HTTP header ``Proxy-Connection:''.

      -

    6. There is the special format %{LA-U:variable} for look-aheads +
    7. There is the special format %{LA-U:variable} for look-aheads which perform an internal (URL-based) sub-request to determine the final value of variable. Use this when you want to use a variable for rewriting which actually is set later in an API phase and thus is not available at the current stage. For instance when you want to rewrite according to the -REMOTE_USER variable from within the per-server context -(httpd.conf file) you have to use %{LA-U:REMOTE_USER} +REMOTE_USER variable from within the per-server context +(httpd.conf file) you have to use %{LA-U:REMOTE_USER} because this variable is set by the authorization phases which come after the URL translation phase where mod_rewrite operates. On the other hand, because mod_rewrite implements its per-directory context -(.htaccess file) via the Fixup phase of the API and because the +(.htaccess file) via the Fixup phase of the API and because the authorization phases come before this phase, you just can use -%{REMOTE_USER} there. +%{REMOTE_USER} there.

      -

    8. There is the special format: %{LA-F:variable} which perform an +
    9. There is the special format: %{LA-F:variable} which perform an internal (filename-based) sub-request to determine the final value of variable. This is the most of the time the same as LA-U above.
    @@ -994,7 +1005,7 @@ which gets applied to the current instance of the TestString, i.e. Extended Regular Expression with some additions:
      -
    1. You can precede the pattern string with a '!' character +
    2. You can precede the pattern string with a '!' character (exclamation mark) to specify a non-matching pattern.

      @@ -1050,7 +1061,7 @@ subrequest to determine the check, so use it with care because it decreases your servers performance!

      - +
      Notice: All of these tests can also be prefixed by a not ('!') character @@ -1066,7 +1077,7 @@ Additionally you can set special flags for CondPattern by appending [flags] -as the third argument to the RewriteCond directive. Flags +as the third argument to the RewriteCond directive. Flags is a comma-separated list of the following flags:
        @@ -1092,7 +1103,7 @@ RewriteRule ...some special stuff for any of these hosts... Example:
        -To rewrite the Homepage of a site according to the ``User-Agent:'' +To rewrite the Homepage of a site according to the ``User-Agent:'' header of the request, you can use the following:
        @@ -1113,7 +1124,7 @@ use any other browser you get the standard homepage.
         

        -


        +

        RewriteRule

        @@ -1131,7 +1142,7 @@ use any other browser you get the standard homepage. >Context: server config, virtual host, per-directory config

        -The RewriteRule directive is the real rewriting workhorse. The +The RewriteRule directive is the real rewriting workhorse. The directive can occur more than once. Each directive then defines one single rewriting rule. The definition order of these rules is important, because this order is used when applying the rules at @@ -1149,9 +1160,9 @@ and made alterations to it. Some hints about the syntax of regular expressions:

        - +
        -
        +
         ^           Start of line
         $           End of line
        @@ -1173,19 +1184,19 @@ Some hints about the syntax of regular expressions:
         

        -Additionally the NOT character ('!') is a possible pattern +Additionally the NOT character ('!') is a possible pattern prefix. This gives you the ability to negate a pattern; to say, for instance: ``if the current URL does NOT match to this pattern''. This can be used for special cases where it is better to match the negative pattern or as a last default rule.

        - +
        Notice: When using the NOT character to negate a pattern you cannot have grouped wildcard parts in the pattern. This is impossible because when the pattern does NOT match, there are no contents for the groups. In -consequence, if negated patterns are used, you cannot use $N in the +consequence, if negated patterns are used, you cannot use $N in the substitution string!
        @@ -1205,8 +1216,8 @@ which is substituted for (or replaces) the original URL for which Back-references are $N (N=1..9) identifiers which will be replaced by the contents of the Nth group of the matched Pattern. The server-variables are the same as for the -TestString of a RewriteCond directive. The -mapping-functions come from the RewriteMap directive and are +TestString of a RewriteCond directive. The +mapping-functions come from the RewriteMap directive and are explained there. These three types of variables are expanded in the order of the above list. @@ -1218,7 +1229,7 @@ rewriting process goes on until there are no more rules (unless explicitly terminated by a L flag - see below).

        -There is a special substitution string named '-' which means: +There is a special substitution string named '-' which means: NO substitution! Sounds silly? No, it is useful to provide rewriting rules which only match some URLs but do no substitution, e.g. in conjunction with the C (chain) flag to be able to have more than one @@ -1232,10 +1243,10 @@ QUERY_STRING. When you want to erase an existing query string, end the substitution string with just the question mark.

        - +
        Notice: There is a special feature. When you prefix a substitution -field with http://thishost[:thisport] then +field with http://thishost[:thisport] then mod_rewrite automatically strips it out. This auto-reduction on implicit external redirect URLs is a useful and important feature when used in combination with a mapping-function which generates the hostname @@ -1243,11 +1254,12 @@ part. Have a look at the first example in the example section below to understand this.
        +

        - +
        @@ -1260,7 +1272,7 @@ Additionally you can set special flags for Substitution by appending [flags] -as the third argument to the RewriteRule directive. Flags is a +as the third argument to the RewriteRule directive. Flags is a comma-separated list of the following flags:
          @@ -1270,8 +1282,8 @@ comma-separated list of the following flags: force a external redirection. If no code is given a HTTP response of 302 (MOVED TEMPORARILY) is used. If you want to use other response codes in the range 300-400 just specify them as a number or use - one of the following symbolic names: temp (default), permanent, - seeother. + one of the following symbolic names: temp (default), permanent, + seeother. Use it for rules which should canonicalize the URL and gives it back to the client, e.g. translate ``/~'' into ``/u/'' or always append a slash to @@ -1298,13 +1310,13 @@ comma-separated list of the following flags: This flag forces the substitution part to be internally forced as a proxy request and immediately (i.e. rewriting rule processing stops here) put through the proxy module. You have to make sure that the substitution - string is a valid URI (e.g. typically http://) which can + string is a valid URI (e.g. typically http://) which can be handled by the Apache proxy module. If not you get an error from the proxy module. Use this flag to achieve a more powerful implementation - of the mod_proxy directive ProxyPass, to map + of the mod_proxy directive ProxyPass, to map some remote stuff into the namespace of the local server.

          - Notice: You really have to put ProxyRequests On into your + Notice: You really have to put ProxyRequests On into your server configuration to prevent proxy requests from leading to core-dumps inside the Apache kernel. If you have not compiled in the proxy module, then there is no core-dump problem, because mod_rewrite checks for @@ -1334,22 +1346,22 @@ comma-separated list of the following flags: effect: if a rule matches, then processing continues as usual, i.e. the flag has no effect. If the rule does not match, then all following chained rules are skipped. For instance, use it to remove the - ``.www'' part inside a per-directory rule set when you let an - external redirect happen (where the ``.www'' part should not to + ``.www'' part inside a per-directory rule set when you let an + external redirect happen (where the ``.www'' part should not to occur!).

        • 'type|T=mime-type' (force MIME type)
          Force the MIME-type of the target file to be mime-type. For - instance, this can be used to simulate the old mod_alias - directive ScriptAlias which internally forces all files inside + instance, this can be used to simulate the old mod_alias + directive ScriptAlias which internally forces all files inside the mapped directory to have a MIME type of - ``application/x-httpd-cgi''. + ``application/x-httpd-cgi''.

        • 'nosubreq|NS' (used only if no internal sub-request)
          This flag forces the rewriting engine to skip a rewriting rule if the current request is an internal sub-request. For instance, sub-requests - occur internally in Apache when mod_include tries to find out - information about possible directory default files (index.xxx). + occur internally in Apache when mod_include tries to find out + information about possible directory default files (index.xxx). On sub-requests it is not always useful and even sometimes causes a failure to if the complete set of rules are applied. Use this flag to exclude some rules.

          @@ -1369,29 +1381,29 @@ comma-separated list of the following flags: This flag forces the rewriting engine to set the uri field of the internal request_rec structure to the value of the filename field. This flag is just a hack to be able - to post-process the output of RewriteRule directives by - Alias, ScriptAlias, Redirect, etc. directives + to post-process the output of RewriteRule directives by + Alias, ScriptAlias, Redirect, etc. directives from other URI-to-filename translators. A trivial example to show the semantics: - If you want to rewrite /abc to /def via the rewriting - engine of mod_rewrite and then /def to /ghi - with mod_alias: + If you want to rewrite /abc to /def via the rewriting + engine of mod_rewrite and then /def to /ghi + with mod_alias:

               RewriteRule ^/abc(.*)  /def$1 [PT]
               Alias       /def       /ghi
               
          - If you omit the PT flag then mod_rewrite - will do its job fine, i.e. it rewrites uri=/abc/... to - filename=/def/... as a full API-compliant URI-to-filename - translator should do. Then mod_alias comes and tries to do a + If you omit the PT flag then mod_rewrite + will do its job fine, i.e. it rewrites uri=/abc/... to + filename=/def/... as a full API-compliant URI-to-filename + translator should do. Then mod_alias comes and tries to do a URI-to-filename transition which will not work.

          Notice: You have to use this flag if you want to intermix directives of different modules which contain URL-to-filename translators. The - typical example is the use of mod_alias and - mod_rewrite.. + typical example is the use of mod_alias and + mod_rewrite..

          -

        Remember: An unconditional external redirect to your own server will -not work with the prefix http://thishost because of this feature. +not work with the prefix http://thishost because of this feature. To achieve such a self-redirect, you have to use the R-flag (see below).
        +
        Notice - For the Apache hackers:
        @@ -1408,23 +1420,23 @@ comma-separated list of the following flags: This flag forces the rewriting engine to skip the next num rules in sequence when the current rule matches. Use this to make pseudo if-then-else constructs: The last rule of the then-clause becomes - a skip=N where N is the number of rules in the else-clause. + a skip=N where N is the number of rules in the else-clause. (This is not the same as the 'chain|C' flag!)

      • 'env|E=VAR:VAL' (set environment variable)
        This forces an environment variable named VAR to be set to the value VAL, where VAL can contain regexp backreferences - $N and %N which will be expanded. You can use this flag + $N and %N which will be expanded. You can use this flag more than once to set more than one variable. The variables can be later dereferenced at a lot of situations, but the usual location will be from - within XSSI (via <!--#echo var="VAR"-->) or CGI (e.g. - $ENV{'VAR'}). But additionally you can also dereference it in a - following RewriteCond pattern via %{ENV:VAR}. Use this to strip + within XSSI (via <!--#echo var="VAR"-->) or CGI (e.g. + $ENV{'VAR'}). But additionally you can also dereference it in a + following RewriteCond pattern via %{ENV:VAR}. Use this to strip but remember information from URLs.

        - +
        Notice: Never forget that Pattern gets applied to a complete URL in per-server configuration files. But in per-directory configuration @@ -1435,18 +1447,18 @@ essential for many sorts of rewriting, because without this prefix stripping you have to match the parent directory which is not always possible.

        There is one exception: If a substitution string starts with -``http://'' then the directory prefix will be not added and a +``http://'' then the directory prefix will be not added and a external redirect or proxy throughput (if flag P is used!) is forced!

        - +
        @@ -1456,11 +1468,11 @@ security reasons. Here are all possible substitution combinations and their meanings:

        -Inside per-server configuration (httpd.conf)
        -for request ``GET /somepath/pathinfo'':

        +Inside per-server configuration (httpd.conf)
        +for request ``GET /somepath/pathinfo'':

        -

        Notice: To enable the rewriting engine for per-directory configuration files -you need to set ``RewriteEngine On'' in these files and -``Option FollowSymLinks'' enabled. If your administrator has -disabled override of FollowSymLinks for a user's directory, then +you need to set ``RewriteEngine On'' in these files and +``Option FollowSymLinks'' enabled. If your administrator has +disabled override of FollowSymLinks for a user's directory, then you cannot use the rewriting engine. This restriction is needed for security reasons.
        +
        @@ -1501,13 +1513,13 @@ for request ``GET /somepath/pathinfo'':

        -Inside per-directory configuration for /somepath
        -(i.e. file .htaccess in dir /physical/path/to/somepath containing -RewriteBase /somepath)
        for -request ``GET /somepath/localpath/pathinfo'':

        +Inside per-directory configuration for /somepath
        +(i.e. file .htaccess in dir /physical/path/to/somepath containing +RewriteBase /somepath)
        for +request ``GET /somepath/localpath/pathinfo'':

        - +
        @@ -1548,7 +1560,6 @@ request ``GET /somepath/localpath/pathinfo'':
        -

        Example:

        @@ -1577,22 +1588,25 @@ RewriteMap real-to-user txt:/anywhere/map.real-to-host RewriteRule ^/([^/]+)/~([^/]+)/(.*)$ /u/${real-to-user:$2|nobody}/$3.$1 + +


        Miscellaneous

        +


        Environment Variables

        This module keeps track of two additional (non-standard) CGI/SSI environment -variables named SCRIPT_URL and SCRIPT_URI. These contain +variables named SCRIPT_URL and SCRIPT_URI. These contain the logical Web-view to the current resource, while the standard CGI/SSI -variables SCRIPT_NAME and SCRIPT_FILENAME contain the +variables SCRIPT_NAME and SCRIPT_FILENAME contain the physical System-view.

        @@ -1606,13 +1620,14 @@ URLs to physical pathnames.

        -SCRIPT_NAME=/v/sw/free/lib/apache/global/u/rse/.www/index.html
        +SCRIPT_NAME=/sw/lib/w3s/tree/global/u/rse/.www/index.html
         SCRIPT_FILENAME=/u/rse/.www/index.html
         SCRIPT_URL=/u/rse/
        -SCRIPT_URI=http://en2.en.sdm.de/u/rse/
        +SCRIPT_URI=http://en1.engelschall.com/u/rse/
         
        +


        Practical Solutions

        @@ -1628,7 +1643,7 @@ rulesets and additional information. -
        +