title: Using placeholder in RewriteCond to be applied to RewriteRule
body: <p>I am using a placeholder in the <code>RewriteCond</code> which I expected to populate <code>$1</code>, and a second placeholder in the <code>RewriteRule</code> which I expected to populate <code>$2</code>.</p>
  
  <p>It appears, however, that <code>$1</code> is the placeholder set by the <code>RewriteRule</code>, and <code>$2</code> is empty.</p>
  
  <p>How can a placeholder be defined in the <code>RewriteCond</code> and applied to the <code>RewriteRule</code>?</p>
  
  <pre><code>    RewriteEngine On
      RewriteBase /
      RewriteCond %{HTTP_HOST} ^(.+).sites.example.com [NC] 
      RewriteRule ^public/(.+)$ public/$1/$2 [NC,L]
  </code></pre>
  
  <p>rewrite log:</p>
  
  <pre><code>[test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html -&gt; public/xxx.html
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html' -&gt; 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html/ -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (4) add subst prefix: public/xxx.html/ -&gt; /public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html/ [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4547b8/initial/redir#1] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b459968/initial/redir#2] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b45eb88/initial/redir#3] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b463dd0/initial/redir#4] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b469218/initial/redir#5] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b46e628/initial/redir#6] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b473d88/initial/redir#7] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b4792d8/initial/redir#8] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b47f498/initial/redir#9] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (3) [perdir /var/www/mysite/html_sites/] add path info postfix: /var/www/mysite/html_sites/public/xxx.html -&gt; /var/www/mysite/html_sites/public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/public/xxx.html/ -&gt; public/xxx.html/
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'public/xxx.html/'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (4) [perdir /var/www/mysite/html_sites/] RewriteCond: input='test.sites.example.com' pattern='^(.+).sites.example.com' [NC] =&gt; matched
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (2) [perdir /var/www/mysite/html_sites/] rewrite 'public/xxx.html/' -&gt; 'public/xxx.html//'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (3) [perdir /var/www/mysite/html_sites/] add per-dir prefix: public/xxx.html// -&gt; /var/www/mysite/html_sites/public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (2) [perdir /var/www/mysite/html_sites/] trying to replace prefix /var/www/mysite/html_sites/ with /
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (5) strip matching prefix: /var/www/mysite/html_sites/public/xxx.html// -&gt; public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (4) add subst prefix: public/xxx.html// -&gt; /public/xxx.html//
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b484cb8/initial/redir#10] (1) [perdir /var/www/mysite/html_sites/] internal redirect with /public/xxx.html// [INTERNAL REDIRECT]
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (3) [perdir /var/www/mysite/html_sites/] strip per-dir prefix: /var/www/mysite/html_sites/favicon.ico -&gt; favicon.ico
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (3) [perdir /var/www/mysite/html_sites/] applying pattern '^public/(.+)$' to uri 'favicon.ico'
  [test.sites.example.com/sid#7f4a2b120f18][rid#7f4a2b43cbf8/initial] (1) [perdir /var/www/mysite/html_sites/] pass through /var/www/mysite/html_sites/favicon.ico
  </code></pre>