From: Christophe Jaillet
For example, you might define a +
For example, you can define a
You would then be able to use this map in a
A default value can be specified in the event that nothing is found in the map:
@@ -117,28 +117,72 @@ once created, in yourRewriteRule
and
may be used, and give examples of each.
+ When a MapType of int
is used, the MapSource is one
+ of the available internal RewriteMap functions. Module authors can provide
+ additional internal functions by registering them with the
+ ap_register_rewrite_mapfunc
API.
+ The functions that are provided by default are:
+
+ To use one of these functions, create a RewriteMap
referencing
+ the int function, and then use that in your RewriteRule
:
+
Redirect a URI to an all-lowercase version of itself
+Please note that the example offered here is for
+ illustration purposes only, and is not a recommendation. If you want
+ to make URLs case-insensitive, consider using
+
When a MapType of txt
is used, the MapSource is a filesystem path to a
- plain-text mapping file, containing space-separated key/value pair
- per line. Optionally, a line may be contain a comment, starting with
+ plain-text mapping file, containing one space-separated key/value pair
+ per line. Optionally, a line may contain a comment, starting with
a '#' character.
For example, the following might be valid entries in a map - file.
+A valid text rewrite map file will have the following syntax:
-
+
MatchingKey SubstValue
MatchingKey SubstValue # comment
-
When the RewriteMap is invoked the argument is looked for in the first argument of a line, and, if found, the substitution value is returned.
-For example, we might use a mapfile to translate product names to +
For example, we can use a mapfile to translate product names to product IDs for easier-to-remember URLs, using the following recipe:
Product to ID configuration
@@ -177,7 +221,7 @@ telephone 328 pattern in order for it to match anything:For example, you might use the following map +
For example, you can use the following map
file and directives to provide a random load balancing between
several back-end servers, via a reverse-proxy. Images are sent
to one of the servers in the 'static' pool, while everything
@@ -217,8 +261,8 @@ dynamic www5|www6
So, when an image is requested and the first of these rules is @@ -294,51 +338,6 @@ by many requests.
When a MapType of int
is used, the MapSource is one
- of the available internal RewriteMap functions. Module authors can provide
- additional internal functions by registering them with the
- ap_register_rewrite_mapfunc
API.
- The functions that are provided by default are:
-
- To use one of these functions, create a RewriteMap
referencing
- the int function, and then use that in your RewriteRule
:
-
Redirect a URI to an all-lowercase version of itself
-Please note that the example offered here is for
- illustration purposes only, and is not a recommendation. If you want
- to make URLs case-insensitive, consider using
-
When a MapType of prg
is used, the MapSource is a
@@ -367,10 +366,9 @@ RewriteRule "(.*)" "${lc:$1}" [R]
A simple example is shown here which will replace all dashes with underscores in a request URI.
- +Rewrite configuration