From: Rich Bowen Date: Tue, 2 Feb 2016 09:50:10 +0000 (+0000) Subject: mod_rewrite doc enhancements from trunk. X-Git-Tag: 2.4.19~234 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=358e5549642629f3065e0241521d7abb3a193979;p=apache mod_rewrite doc enhancements from trunk. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1728060 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index ffc1dc0deb..09d4316741 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -132,8 +132,6 @@ URLs on the fly server configvirtual host directory.htaccess FileInfo -MaxRedirects is no longer available in version 2.1 and -later

The RewriteOptions directive sets some @@ -264,15 +262,13 @@ later

IgnoreContextInfo
-

In versions 2.4.13 and later, when a relative substitution is made +

When a relative substitution is made in directory (htaccess) context and RewriteBase has not been set, this module uses some extended URL and filesystem context information to change the relative substitution back into a URL. Modules such as mod_userdir and mod_alias - supply this extended context info. This option disables the behavior - introduced in 2.4.13 and should only be set if all of the conditions - above are present and a substituion has an unexpected result.

+ supply this extended context info.

@@ -284,6 +280,7 @@ later RewriteMap Defines a mapping function for key-lookup RewriteMap MapName MapType:MapSource + MapTypeOptions server configvirtual host @@ -321,16 +318,21 @@ later RewriteMap as:

- RewriteMap "examplemap" "txt:/path/to/file/map.txt" +RewriteMap examplemap "txt:/path/to/file/map.txt"

You would then be able to use this map in a RewriteRule as follows:

- RewriteRule "^/ex/(.*)" "${examplemap:$1}" +RewriteRule "^/ex/(.*)" "${examplemap:$1}" +

The meaning of the MapTypeOptions argument depends on + particular MapType. See the + Using RewriteMap for + more information.

+

The following combinations for MapType and MapSource can be used:

@@ -395,7 +397,7 @@ later RewriteRule, suffixed by the relative substitution is also valid as a URL path on the server (this is rare). -
  • In Apache HTTP Server 2.4.13 and later, this directive may be +
  • In Apache HTTP Server 2.4.11 and later, this directive may be omitted when the request is mapped via Alias or mod_userdir.
  • @@ -411,7 +413,7 @@ DocumentRoot "/var/www/example.com" AliasMatch "^/myapp" "/opt/myapp-1.2.3" <Directory "/opt/myapp-1.2.3"> RewriteEngine On - RewriteBase /myapp/ + RewriteBase "/myapp/" RewriteRule "^index\.html$" "welcome.html" </Directory> @@ -757,136 +759,152 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
  • You can perform lexicographical string comparisons: -
      -
    • '<CondPattern' (lexicographically - precedes)
      +
      +
      <CondPattern
      +
      Lexicographically precedes
      Treats the CondPattern as a plain string and compares it lexicographically to TestString. True if TestString lexicographically precedes - CondPattern.
    • + CondPattern. -
    • '>CondPattern' (lexicographically - follows)
      +
      >CondPattern
      +
      Lexicographically follows
      Treats the CondPattern as a plain string and compares it lexicographically to TestString. True if TestString lexicographically follows - CondPattern.
    • + CondPattern. -
    • '=CondPattern' (lexicographically - equal)
      +
      =CondPattern
      +
      Lexicographically equal
      Treats the CondPattern as a plain string and compares it lexicographically to TestString. True if TestString is lexicographically equal to CondPattern (the two strings are exactly equal, character for character). If CondPattern is "" (two quotation marks) this - compares TestString to the empty string.
    • + compares TestString to the empty string. -
    • '<=CondPattern' (lexicographically - less than or equal to)
      +
      <=CondPattern
      +
      Lexicographically less than or equal to
      Treats the CondPattern as a plain string and compares it lexicographically to TestString. True if TestString lexicographically precedes CondPattern, or is equal to CondPattern - (the two strings are equal, character for character).
    • + (the two strings are equal, character for character). -
    • '>=CondPattern' (lexicographically - greater than or equal to)
      +
      >=CondPattern
      +
      Lexicographically greater than or equal to
      Treats the CondPattern as a plain string and compares it lexicographically to TestString. True if TestString lexicographically follows CondPattern, or is equal to CondPattern - (the two strings are equal, character for character).
    • -
  • + (the two strings are equal, character for character). + +
  • You can perform integer comparisons: -
      +
      -
    • '-eq' (is numerically - equal to)
      +
      -eq
      +
      Is numerically equal to
      The TestString is treated as an integer, and is numerically compared to the CondPattern. True if - the two are numerically equal.
    • + the two are numerically equal. -
    • '-ge' (is numerically - greater than or equal to)
      +
      -ge
      +
      Is numerically greater than or equal to
      The TestString is treated as an integer, and is numerically compared to the CondPattern. True if the TestString is numerically greater than or equal - to the CondPattern.
    • + to the CondPattern. -
    • '-gt' (is numerically - greater than)
      +
      -gt
      +
      Is numerically greater than
      The TestString is treated as an integer, and is numerically compared to the CondPattern. True if the TestString is numerically greater than - the CondPattern.
    • + the CondPattern. -
    • '-le' (is numerically - less than or equal to)
      +
      -le
      +
      Is numerically less than or equal to
      The TestString is treated as an integer, and is numerically compared to the CondPattern. True if the TestString is numerically less than or equal to the CondPattern. Avoid confusion with the -l by using the -L or - -h variant.
    • + -h variant. -
    • '-lt' (is numerically - less than)
      +
      -lt
      +
      Is numerically less than
      The TestString is treated as an integer, and is numerically compared to the CondPattern. True if the TestString is numerically less than the CondPattern. Avoid confusion with the -l by using the -L or - -h variant.
    • + -h variant. -
    +
  • You can perform various file attribute tests: -
      -
    • '-d' (is - directory)
      + + +
      + +
      -d
      + +
      Is directory.
      Treats the TestString as a pathname and tests - whether or not it exists, and is a directory.
    • + whether or not it exists, and is a directory. + + +
      -f
      + +
      Is regular file.
      -
    • '-f' (is regular - file)
      Treats the TestString as a pathname and tests - whether or not it exists, and is a regular file.
    • + whether or not it exists, and is a regular file. +
      -
    • '-F' (is existing file, via - subrequest)
      +
      -F
      + +
      Is existing file, via subrequest.
      Checks whether or not TestString is a valid file, accessible via all the server's currently-configured access controls for that path. This uses an internal subrequest to do the check, so use it with care - - it can impact your server's performance!
    • + it can impact your server's performance! + -
    • '-H' (is symbolic link, bash convention)
      - See -l.
    • +
      -H
      +
      Is symbolic link, bash convention.
      + See -l. +
      -
    • '-l' (is symbolic - link)
      +
      -l
      + +
      Is symbolic link.
      Treats the TestString as a pathname and tests whether or not it exists, and is a symbolic link. May also use the bash convention of -L or -h if there's a possibility of confusion such as when using the -lt or - -le tests.
    • + -le tests. + -
    • '-L' (is symbolic link, bash convention)
      - See -l.
    • +
      -L
      +
      Is symbolic link, bash convention.
      + See -l.
      -
    • '-s' (is regular file, with - size)
      +
      -s
      +
      Is regular file, with size.
      Treats the TestString as a pathname and tests whether or not it exists, and is a regular file with size greater - than zero.
    • + than zero. -
    • '-U' (is existing URL, via - subrequest)
      +

      -U
      +

      Is existing URL, via subrequest.
      Checks whether or not TestString is a valid URL, accessible via all the server's currently-configured access controls for that path. This uses an internal @@ -896,16 +914,23 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3" like access control, authentication, and authorization. This flag does not return information about the status code the configured handler (static file, CGI, proxy, etc.) would have - returned.

    • + returned.

      -
    • '-x' (has executable - permissions)
      +
      -x
      +
      Has executable permissions.
      Treats the TestString as a pathname and tests whether or not it exists, and has executable permissions. These permissions are determined according to - the underlying OS.
    • + the underlying OS. + + + + For example: -
    + + RewriteCond /var/www/%{REQUEST_URI} !-f + RewriteRule ^(.+) /other/archive/$1 [R] +
  • @@ -921,8 +946,8 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"

    - RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"
    - RewriteRule "^/images" "-" [F] +RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"
    +RewriteRule "^/images" "-" [F]
    @@ -1218,10 +1243,18 @@ cannot use $N in the substitution string! B - Escape non-alphanumeric characters before applying - the transformation. Escape non-alphanumeric characters in backreferences before + applying the transformation. details ... + + backrefnoplus|BNP + If backreferences are being escaped, spaces should be escaped to + %20 instead of +. Useful when the backreference will be used in the + path component rather than the query string.details ... + + chain|C Rule is chained to the following rule. If the rule fails, @@ -1439,7 +1472,7 @@ directive.

    Inside per-directory configuration for /somepath
    (/physical/path/to/somepath/.htaccess, with - RewriteBase /somepath)
    + RewriteBase "/somepath")
    for request ``GET /somepath/localpath/pathinfo'':