title: Rewrite URL to match Locationmatch
body: <p>I would need some assistance with a rewrite.</p>
  
  <p>There's two rules which needs to be applied:
  1. Base the RewriteCond on HTTP_USER_AGENT
  2. Add paths to the URL to match with LocationMatch</p>
  
  <p>What I've right now which is broken:</p>
  
  <pre><code>RewriteCond %{HTTP_USER_AGENT} ^git
  RewriteRule ^(.*)$ /git/$1 [L]
  </code></pre>
  
  <p>Removing the RewriteRule and querying the path right away works fine, but running with this rule renders apache "unable to find file".</p>
  
  <p>The match is a LocationMatch  <code>&lt;LocationMatch "/git/"&gt;</code>, so I'm not sure if a RewriteRule can point at that?</p>
  
  <p>Full config:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  DocumentRoot /home/subgit/repos
  
      &lt;Directory /home/subgit/repos&gt;
          Options       None
          AllowOverride none
          Order         allow,deny
          Allow         from all
      &lt;/Directory&gt;
  
  CustomLog /home/subgit/logs/access_log combined
  SuexecUserGroup subgit subgit
  
  RewriteEngine On
  RewriteCond %{HTTP_USER_AGENT} ^git
  RewriteRule ^(.*)$ /git/$1 [L]
  
  RewriteCond %{QUERY_STRING} service=git-receive-pack [OR,NC]
  RewriteCond %{REQUEST_URI} ^/git/.*/git-receive-pack$ [NC]
  RewriteRule .* - [E=AUTHREQUIRED:yes]
  
  ScriptAlias /git/ /home/subgit/bin/gitolite-suexec-wrapper.sh/
  
   &lt;LocationMatch "/git/"&gt;
      Order Allow,Deny
      Deny from env=AUTHREQUIRED
      Allow from all
      Satisfy Any
      AuthType Basic
      AuthName "subgit"
      AuthBasicProvider file
      AuthUserFile /home/subgit/etc/subgit
      Require valid-user
    &lt;/LocationMatch&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Thanks</p>