From: Rich Bowen Date: Tue, 17 Nov 2009 02:44:19 +0000 (+0000) Subject: Moves the last of the rules from the monolithic rewrite_guide into X-Git-Tag: 2.3.4~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3aff21153e5145b6bd7b5455f4e13aa6ba7885c0;p=apache Moves the last of the rules from the monolithic rewrite_guide into topic-specific sub-pages. Still a lot of cleanup and improvement can be done, but this is a good first step. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@881110 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/rewrite/advanced.html.en b/docs/manual/rewrite/advanced.html.en index 271cc4c6cb..ff33735402 100644 --- a/docs/manual/rewrite/advanced.html.en +++ b/docs/manual/rewrite/advanced.html.en @@ -36,6 +36,10 @@ configuration.
  • On-the-fly Content-Regeneration
  • Load Balancing
  • Document With Autorefresh
  • +
  • Structured Userdirs
  • +
  • Redirecting Anchors
  • +
  • Time-Dependent Rewriting
  • +
  • Set Environment Variables Based On URL Parts
  • See also

    top
    @@ -335,6 +339,150 @@ exit(0); +
    top
    +
    +

    Structured Userdirs

    + + + +
    +
    Description:
    + +
    +

    Some sites with thousands of users use a + structured homedir layout, i.e. each homedir is in a + subdirectory which begins (for instance) with the first + character of the username. So, /~larry/anypath + is /home/l/larry/public_html/anypath + while /~waldo/anypath is + /home/w/waldo/public_html/anypath.

    +
    + +
    Solution:
    + +
    +

    We use the following ruleset to expand the tilde URLs + into the above layout.

    + +
    +RewriteEngine on
    +RewriteRule   ^/~(([a-z])[a-z0-9]+)(.*)  /home/$2/$1/public_html$3
    +
    +
    +
    + +
    top
    +
    +

    Redirecting Anchors

    + + + +
    +
    Description:
    + +
    +

    By default, redirecting to an HTML anchor doesn't work, + because mod_rewrite escapes the # character, + turning it into %23. This, in turn, breaks the + redirection.

    +
    + +
    Solution:
    + +
    +

    Use the [NE] flag on the + RewriteRule. NE stands for No Escape. +

    +
    + +
    Discussion:
    +
    This technique will of course also work with with other + special characters that mod_rewrite, by default, URL-encodes.
    +
    + +
    top
    +
    +

    Time-Dependent Rewriting

    + + + +
    +
    Description:
    + +
    +

    We wish to use mod_rewrite to serve different content based on + the time of day.

    +
    + +
    Solution:
    + +
    +

    There are a lot of variables named TIME_xxx + for rewrite conditions. In conjunction with the special + lexicographic comparison patterns <STRING, + >STRING and =STRING we can + do time-dependent redirects:

    + +
    +RewriteEngine on
    +RewriteCond   %{TIME_HOUR}%{TIME_MIN} >0700
    +RewriteCond   %{TIME_HOUR}%{TIME_MIN} <1900
    +RewriteRule   ^foo\.html$             foo.day.html [L]
    +RewriteRule   ^foo\.html$             foo.night.html
    +
    + +

    This provides the content of foo.day.html + under the URL foo.html from + 07:01-18:59 and at the remaining time the + contents of foo.night.html.

    + +
    mod_cache, intermediate proxies + and browsers may each cache responses and cause the either page to be + shown outside of the time-window configured. + mod_expires may be used to control this + effect. You are, of course, much better off simply serving the + content dynamically, and customizing it based on the time of day.
    + +
    +
    + +
    top
    +
    +

    Set Environment Variables Based On URL Parts

    + + + +
    +
    Description:
    + +
    +

    At time, we want to maintain some kind of status when we + perform a rewrite. For example, you want to make a note that + you've done that rewrite, so that you can check later to see if a + request can via that rewrite. One way to do this is by setting an + environment variable.

    +
    + +
    Solution:
    + +
    +

    Use the [E] flag to set an environment variable.

    + +
    +RewriteEngine on
    +RewriteRule   ^/horse/(.*)   /pony/$1 [E=rewritten:1]
    +
    + +

    Later in your ruleset you might check for this environment + variable using a RewriteCond:

    + +
    +RewriteCond %{ENV:rewritten} =1
    +
    + +
    +
    +

    Available Languages:  en 

    diff --git a/docs/manual/rewrite/advanced.xml b/docs/manual/rewrite/advanced.xml index 86fe6abace..67253d187a 100644 --- a/docs/manual/rewrite/advanced.xml +++ b/docs/manual/rewrite/advanced.xml @@ -343,4 +343,148 @@ exit(0); +
    + + Structured Userdirs + +
    +
    Description:
    + +
    +

    Some sites with thousands of users use a + structured homedir layout, i.e. each homedir is in a + subdirectory which begins (for instance) with the first + character of the username. So, /~larry/anypath + is /home/l/larry/public_html/anypath + while /~waldo/anypath is + /home/w/waldo/public_html/anypath.

    +
    + +
    Solution:
    + +
    +

    We use the following ruleset to expand the tilde URLs + into the above layout.

    + +
    +RewriteEngine on
    +RewriteRule   ^/~(([a-z])[a-z0-9]+)(.*)  /home/$2/$1/public_html$3
    +
    +
    +
    + +
    + +
    + + Redirecting Anchors + +
    +
    Description:
    + +
    +

    By default, redirecting to an HTML anchor doesn't work, + because mod_rewrite escapes the # character, + turning it into %23. This, in turn, breaks the + redirection.

    +
    + +
    Solution:
    + +
    +

    Use the [NE] flag on the + RewriteRule. NE stands for No Escape. +

    +
    + +
    Discussion:
    +
    This technique will of course also work with with other + special characters that mod_rewrite, by default, URL-encodes.
    +
    + +
    + +
    + + Time-Dependent Rewriting + +
    +
    Description:
    + +
    +

    We wish to use mod_rewrite to serve different content based on + the time of day.

    +
    + +
    Solution:
    + +
    +

    There are a lot of variables named TIME_xxx + for rewrite conditions. In conjunction with the special + lexicographic comparison patterns <STRING, + >STRING and =STRING we can + do time-dependent redirects:

    + +
    +RewriteEngine on
    +RewriteCond   %{TIME_HOUR}%{TIME_MIN} >0700
    +RewriteCond   %{TIME_HOUR}%{TIME_MIN} <1900
    +RewriteRule   ^foo\.html$             foo.day.html [L]
    +RewriteRule   ^foo\.html$             foo.night.html
    +
    + +

    This provides the content of foo.day.html + under the URL foo.html from + 07:01-18:59 and at the remaining time the + contents of foo.night.html.

    + + mod_cache, intermediate proxies + and browsers may each cache responses and cause the either page to be + shown outside of the time-window configured. + mod_expires may be used to control this + effect. You are, of course, much better off simply serving the + content dynamically, and customizing it based on the time of day. + +
    +
    + +
    + +
    + + Set Environment Variables Based On URL Parts + +
    +
    Description:
    + +
    +

    At time, we want to maintain some kind of status when we + perform a rewrite. For example, you want to make a note that + you've done that rewrite, so that you can check later to see if a + request can via that rewrite. One way to do this is by setting an + environment variable.

    +
    + +
    Solution:
    + +
    +

    Use the [E] flag to set an environment variable.

    + +
    +RewriteEngine on
    +RewriteRule   ^/horse/(.*)   /pony/$1 [E=rewritten:1]
    +
    + +

    Later in your ruleset you might check for this environment + variable using a RewriteCond:

    + +
    +RewriteCond %{ENV:rewritten} =1
    +
    + +
    +
    + +
    + diff --git a/docs/manual/rewrite/remapping.html.en b/docs/manual/rewrite/remapping.html.en index 452c9ae8dc..48981ace51 100644 --- a/docs/manual/rewrite/remapping.html.en +++ b/docs/manual/rewrite/remapping.html.en @@ -46,6 +46,8 @@ configuration.
  • Canonical URLs
  • Virtual Hosts Per User
  • Moved DocumentRoot
  • +
  • Mass Virtual Hosting
  • +
  • Proxying Content with mod_rewrite
  • See also

    top
    @@ -254,6 +256,8 @@ RewriteRule ^(.*).html$ $1.php

    Canonical Hostnames

    + +
    Description:
    @@ -585,6 +589,77 @@ rather than rewriting URLs.

    +
    top
    +
    +

    Mass Virtual Hosting

    + + + +
    +
    Description:
    + +
    +

    Mass virtual hosting is one of the more common uses of + mod_rewrite. However, it is seldom the best way to handle mass + virtual hosting. This topic is discussed at great length in the virtual host documentation.

    +
    +
    + +
    top
    +
    +

    Proxying Content with mod_rewrite

    + + + +
    +
    Description:
    + +
    +

    + mod_rewrite provides the [P] flag, which allows URLs to be passed, + via mod_proxy, to another server. Two examples are given here. In + one example, a URL is passed directly to another server, and served + as though it were a local URL. In the other example, we proxy + missing content to a back-end server.

    +
    + +
    Solution:
    + +
    +

    To simply map a URL to another server, we use the [P] flag, as + follows:

    + +
    +RewriteEngine  on
    +RewriteBase    /products/
    +RewriteRule    ^widget/(.*)$  http://product.example.com/widget/$1  [P]
    +ProxyPassReverse /products/widget/ http://product.example.com/widget/
    +
    + +

    In the second example, we proxy the request only if we can't find + the resource locally. This can be very useful when you're migrating + from one server to another, and you're not sure if all the content + has been migrated yet.

    + +
    +RewriteCond %{REQUEST_FILENAME}       !-f
    +RewriteCond %{REQUEST_FILENAME}       !-d
    +RewriteRule ^/(.*) http://old.example.com$1 [P]
    +ProxyPassReverse / http://old.example.com/
    +
    +
    + +
    Discussion:
    + +

    In each case, we add a ProxyPassReverse directive to ensure + that any redirects issued by the backend are correctly passed on to + the client.

    + +

    Consider using either ProxyPass or ProxyPassMatch whenever possible in + preference to mod_rewrite.

    +
    +
    +

    Available Languages:  en 

    diff --git a/docs/manual/rewrite/remapping.xml b/docs/manual/rewrite/remapping.xml index a1e48e74cc..142ea6dd06 100644 --- a/docs/manual/rewrite/remapping.xml +++ b/docs/manual/rewrite/remapping.xml @@ -253,7 +253,9 @@ RewriteRule ^(.*).html$ $1.php -
    Canonical Hostnames +
    + +Canonical Hostnames
    Description:
    @@ -591,4 +593,81 @@ rather than rewriting URLs.

    +
    + + Mass Virtual Hosting + +
    +
    Description:
    + +
    +

    Mass virtual hosting is one of the more common uses of + mod_rewrite. However, it is seldom the best way to handle mass + virtual hosting. This topic is discussed at great length in the virtual host documentation.

    +
    +
    + +
    + +
    + + Proxying Content with mod_rewrite + +
    +
    Description:
    + +
    +

    + mod_rewrite provides the [P] flag, which allows URLs to be passed, + via mod_proxy, to another server. Two examples are given here. In + one example, a URL is passed directly to another server, and served + as though it were a local URL. In the other example, we proxy + missing content to a back-end server.

    +
    + +
    Solution:
    + +
    +

    To simply map a URL to another server, we use the [P] flag, as + follows:

    + +
    +RewriteEngine  on
    +RewriteBase    /products/
    +RewriteRule    ^widget/(.*)$  http://product.example.com/widget/$1  [P]
    +ProxyPassReverse /products/widget/ http://product.example.com/widget/
    +
    + +

    In the second example, we proxy the request only if we can't find + the resource locally. This can be very useful when you're migrating + from one server to another, and you're not sure if all the content + has been migrated yet.

    + +
    +RewriteCond %{REQUEST_FILENAME}       !-f
    +RewriteCond %{REQUEST_FILENAME}       !-d
    +RewriteRule ^/(.*) http://old.example.com$1 [P]
    +ProxyPassReverse / http://old.example.com/
    +
    +
    + +
    Discussion:
    + +

    In each case, we add a ProxyPassReverse directive to ensure + that any redirects issued by the backend are correctly passed on to + the client.

    + +

    Consider using either ProxyPass or ProxyPassMatch whenever possible in + preference to mod_rewrite.

    +
    +
    + +
    + + + diff --git a/docs/manual/rewrite/rewrite_guide.html.en b/docs/manual/rewrite/rewrite_guide.html.en index 353e2801b5..1e05b9d27a 100644 --- a/docs/manual/rewrite/rewrite_guide.html.en +++ b/docs/manual/rewrite/rewrite_guide.html.en @@ -41,509 +41,11 @@ avoids many problems.
    -

    See also

    +

    Available Languages:  en  |  fr 

    diff --git a/docs/manual/rewrite/rewrite_guide.xml b/docs/manual/rewrite/rewrite_guide.xml index eab1dd105b..3a871075be 100644 --- a/docs/manual/rewrite/rewrite_guide.xml +++ b/docs/manual/rewrite/rewrite_guide.xml @@ -53,496 +53,6 @@ introduction useful examples Technical details -
    - - Trailing Slash Problem - -
    -
    Description:
    - -

    The vast majority of "trailing slash" problems can be dealt - with using the techniques discussed in the FAQ - entry. However, occasionally, there is a need to use mod_rewrite - to handle a case where a missing trailing slash causes a URL to - fail. This can happen, for example, after a series of complex - rewrite rules.

    -
    - -
    Solution:
    - -
    -

    The solution to this subtle problem is to let the server - add the trailing slash automatically. To do this - correctly we have to use an external redirect, so the - browser correctly requests subsequent images etc. If we - only did a internal rewrite, this would only work for the - directory page, but would go wrong when any images are - included into this page with relative URLs, because the - browser would request an in-lined object. For instance, a - request for image.gif in - /~quux/foo/index.html would become - /~quux/image.gif without the external - redirect!

    - -

    So, to do this trick we write:

    - -
    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^foo$  foo/  [R]
    -
    - -

    Alternately, you can put the following in a - top-level .htaccess file in the content directory. - But note that this creates some processing overhead.

    - -
    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteCond    %{REQUEST_FILENAME}  -d
    -RewriteRule    ^(.+[^/])$           $1/  [R]
    -
    -
    -
    - -
    - -
    - - Set Environment Variables According To URL Parts - -
    -
    Description:
    - -
    -

    Perhaps you want to keep status information between - requests and use the URL to encode it. But you don't want - to use a CGI wrapper for all pages just to strip out this - information.

    -
    - -
    Solution:
    - -
    -

    We use a rewrite rule to strip out the status information - and remember it via an environment variable which can be - later dereferenced from within XSSI or CGI. This way a - URL /foo/S=java/bar/ gets translated to - /foo/bar/ and the environment variable named - STATUS is set to the value "java".

    - -
    -RewriteEngine on
    -RewriteRule   ^(.*)/S=([^/]+)/(.*)    $1/$3 [E=STATUS:$2]
    -
    -
    -
    - -
    - -
    - - Redirect Homedirs For Foreigners - -
    -
    Description:
    - -
    -

    We want to redirect homedir URLs to another webserver - www.somewhere.com when the requesting user - does not stay in the local domain - ourdomain.com. This is sometimes used in - virtual host contexts.

    -
    - -
    Solution:
    - -
    -

    Just a rewrite condition:

    - -
    -RewriteEngine on
    -RewriteCond   %{REMOTE_HOST}  !^.+\.ourdomain\.com$
    -RewriteRule   ^(/~.+)         http://www.somewhere.com/$1 [R,L]
    -
    -
    -
    - -
    - -
    - - Redirecting Anchors - -
    -
    Description:
    - -
    -

    By default, redirecting to an HTML anchor doesn't work, - because mod_rewrite escapes the # character, - turning it into %23. This, in turn, breaks the - redirection.

    -
    - -
    Solution:
    - -
    -

    Use the [NE] flag on the - RewriteRule. NE stands for No Escape. -

    -
    -
    - -
    - -
    - - Time-Dependent Rewriting - -
    -
    Description:
    - -
    -

    When tricks like time-dependent content should happen a - lot of webmasters still use CGI scripts which do for - instance redirects to specialized pages. How can it be done - via mod_rewrite?

    -
    - -
    Solution:
    - -
    -

    There are a lot of variables named TIME_xxx - for rewrite conditions. In conjunction with the special - lexicographic comparison patterns <STRING, - >STRING and =STRING we can - do time-dependent redirects:

    - -
    -RewriteEngine on
    -RewriteCond   %{TIME_HOUR}%{TIME_MIN} >0700
    -RewriteCond   %{TIME_HOUR}%{TIME_MIN} <1900
    -RewriteRule   ^foo\.html$             foo.day.html
    -RewriteRule   ^foo\.html$             foo.night.html
    -
    - -

    This provides the content of foo.day.html - under the URL foo.html from - 07:01-18:59 and at the remaining time the - contents of foo.night.html. Just a nice - feature for a homepage...

    - - mod_cache, intermediate proxies - and browsers may each cache responses and cause the either page to be - shown outside of the time-window configured. - mod_expires may be used to control this - effect. - -
    -
    - -
    - -
    - - Structured Homedirs - -
    -
    Description:
    - -
    -

    Some sites with thousands of users use a - structured homedir layout, i.e. each homedir is in a - subdirectory which begins (for instance) with the first - character of the username. So, /~foo/anypath - is /home/f/foo/.www/anypath - while /~bar/anypath is - /home/b/bar/.www/anypath.

    -
    - -
    Solution:
    - -
    -

    We use the following ruleset to expand the tilde URLs - into the above layout.

    - -
    -RewriteEngine on
    -RewriteRule   ^/~(([a-z])[a-z0-9]+)(.*)  /home/$2/$1/.www$3
    -
    -
    -
    - -
    - -
    - - Dynamic Mirror - -
    -
    Description:
    - -
    -

    Assume there are nice web pages on remote hosts we want - to bring into our namespace. For FTP servers we would use - the mirror program which actually maintains an - explicit up-to-date copy of the remote data on the local - machine. For a web server we could use the program - webcopy which runs via HTTP. But both - techniques have a major drawback: The local copy is - always only as up-to-date as the last time we ran the program. It - would be much better if the mirror was not a static one we - have to establish explicitly. Instead we want a dynamic - mirror with data which gets updated automatically - as needed on the remote host(s).

    -
    - -
    Solution:
    - -
    -

    To provide this feature we map the remote web page or even - the complete remote web area to our namespace by the use - of the Proxy Throughput feature - (flag [P]):

    - -
    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^hotsheet/(.*)$  http://www.tstimpreso.com/hotsheet/$1  [P]
    -
    - -
    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^usa-news\.html$   http://www.quux-corp.com/news/index.html  [P]
    -
    -
    -
    - -
    - -
    - - Retrieve Missing Data from Intranet - -
    -
    Description:
    - -
    -

    This is a tricky way of virtually running a corporate - (external) Internet web server - (www.quux-corp.dom), while actually keeping - and maintaining its data on an (internal) Intranet web server - (www2.quux-corp.dom) which is protected by a - firewall. The trick is that the external web server retrieves - the requested data on-the-fly from the internal - one.

    -
    - -
    Solution:
    - -
    -

    First, we must make sure that our firewall still - protects the internal web server and only the - external web server is allowed to retrieve data from it. - On a packet-filtering firewall, for instance, we could - configure a firewall ruleset like the following:

    - -
    -ALLOW Host www.quux-corp.dom Port >1024 --> Host www2.quux-corp.dom Port 80
    -DENY  Host *                 Port *     --> Host www2.quux-corp.dom Port 80
    -
    - -

    Just adjust it to your actual configuration syntax. - Now we can establish the mod_rewrite - rules which request the missing data in the background - through the proxy throughput feature:

    - -
    -RewriteRule ^/~([^/]+)/?(.*)          /home/$1/.www/$2 [C]
    -# REQUEST_FILENAME usage below is correct in this per-server context example 
    -# because the rule that references REQUEST_FILENAME is chained to a rule that
    -# sets REQUEST_FILENAME. 
    -RewriteCond %{REQUEST_FILENAME}       !-f
    -RewriteCond %{REQUEST_FILENAME}       !-d
    -RewriteRule ^/home/([^/]+)/.www/?(.*) http://www2.quux-corp.dom/~$1/pub/$2 [P]
    -
    -
    -
    - -
    - -
    - - New MIME-type, New Service - -
    -
    Description:
    - -
    -

    On the net there are many nifty CGI programs. But - their usage is usually boring, so a lot of webmasters - don't use them. Even Apache's Action handler feature for - MIME-types is only appropriate when the CGI programs - don't need special URLs (actually PATH_INFO - and QUERY_STRINGS) as their input. First, - let us configure a new file type with extension - .scgi (for secure CGI) which will be processed - by the popular cgiwrap program. The problem - here is that for instance if we use a Homogeneous URL Layout - (see above) a file inside the user homedirs might have a URL - like /u/user/foo/bar.scgi, but - cgiwrap needs URLs in the form - /~user/foo/bar.scgi/. The following rule - solves the problem:

    - -
    -RewriteRule ^/[uge]/([^/]+)/\.www/(.+)\.scgi(.*) ...
    -... /internal/cgi/user/cgiwrap/~$1/$2.scgi$3  [NS,T=application/x-http-cgi]
    -
    - -

    Or assume we have some more nifty programs: - wwwlog (which displays the - access.log for a URL subtree) and - wwwidx (which runs Glimpse on a URL - subtree). We have to provide the URL area to these - programs so they know which area they are really working with. - But usually this is complicated, because they may still be - requested by the alternate URL form, i.e., typically we would - run the swwidx program from within - /u/user/foo/ via hyperlink to

    - -
    -/internal/cgi/user/swwidx?i=/u/user/foo/
    -
    - -

    which is ugly, because we have to hard-code - both the location of the area - and the location of the CGI inside the - hyperlink. When we have to reorganize, we spend a - lot of time changing the various hyperlinks.

    -
    - -
    Solution:
    - -
    -

    The solution here is to provide a special new URL format - which automatically leads to the proper CGI invocation. - We configure the following:

    - -
    -RewriteRule   ^/([uge])/([^/]+)(/?.*)/\*  /internal/cgi/user/wwwidx?i=/$1/$2$3/
    -RewriteRule   ^/([uge])/([^/]+)(/?.*):log /internal/cgi/user/wwwlog?f=/$1/$2$3
    -
    - -

    Now the hyperlink to search at - /u/user/foo/ reads only

    - -
    -HREF="*"
    -
    - -

    which internally gets automatically transformed to

    - -
    -/internal/cgi/user/wwwidx?i=/u/user/foo/
    -
    - -

    The same approach leads to an invocation for the - access log CGI program when the hyperlink - :log gets used.

    -
    -
    - -
    - -
    - - Mass Virtual Hosting - -
    -
    Description:
    - -
    -

    The VirtualHost feature of Apache is nice - and works great when you just have a few dozen - virtual hosts. But when you are an ISP and have hundreds of - virtual hosts, this feature is suboptimal.

    -
    - -
    Solution:
    - -
    -

    To provide this feature we map the remote web page or even - the complete remote web area to our namespace using the - Proxy Throughput feature (flag [P]):

    - -
    -##
    -##  vhost.map
    -##
    -www.vhost1.dom:80  /path/to/docroot/vhost1
    -www.vhost2.dom:80  /path/to/docroot/vhost2
    -     :
    -www.vhostN.dom:80  /path/to/docroot/vhostN
    -
    - -
    -##
    -##  httpd.conf
    -##
    -    :
    -#   use the canonical hostname on redirects, etc.
    -UseCanonicalName on
    -
    -    :
    -#   add the virtual host in front of the CLF-format
    -CustomLog  /path/to/access_log  "%{VHOST}e %h %l %u %t \"%r\" %>s %b"
    -    :
    -
    -#   enable the rewriting engine in the main server
    -RewriteEngine on
    -
    -#   define two maps: one for fixing the URL and one which defines
    -#   the available virtual hosts with their corresponding
    -#   DocumentRoot.
    -RewriteMap    lowercase    int:tolower
    -RewriteMap    vhost        txt:/path/to/vhost.map
    -
    -#   Now do the actual virtual host mapping
    -#   via a huge and complicated single rule:
    -#
    -#   1. make sure we don't map for common locations
    -RewriteCond   %{REQUEST_URI}  !^/commonurl1/.*
    -RewriteCond   %{REQUEST_URI}  !^/commonurl2/.*
    -    :
    -RewriteCond   %{REQUEST_URI}  !^/commonurlN/.*
    -#
    -#   2. make sure we have a Host header, because
    -#      currently our approach only supports
    -#      virtual hosting through this header
    -RewriteCond   %{HTTP_HOST}  !^$
    -#
    -#   3. lowercase the hostname
    -RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$
    -#
    -#   4. lookup this hostname in vhost.map and
    -#      remember it only when it is a path
    -#      (and not "NONE" from above)
    -RewriteCond   ${vhost:%1}  ^(/.*)$
    -#
    -#   5. finally we can map the URL to its docroot location
    -#      and remember the virtual host for logging purposes
    -RewriteRule   ^/(.*)$   %1/$1  [E=VHOST:${lowercase:%{HTTP_HOST}}]
    -    :
    -
    -
    -
    - -
    -