title: Apache VirtualHost subdomain forwarding to Mercurial cgi script
body: <p>I need to hook up my Mercurial server cgi script through an Apache VirtualHost subdomain along with authorization.</p>
  
  <p>My apache is running on 80 and 91.
  Apache is serving Mercurial through</p>
  
  <p>C:\wamp\bin\apache\Apache2.2.21\cgi-bin\hgweb.cgi
  and is accessable through</p>
  
  <p><a href="http://my.com/cgi-bin/hgweb.cgi" rel="nofollow">http://my.com/cgi-bin/hgweb.cgi</a>
  and
  <a href="http://localhost/cgi-bin/hgweb.cgi" rel="nofollow">http://localhost/cgi-bin/hgweb.cgi</a></p>
  
  <p>All well and good, it serves perfectly there. My target is to subdomain it as:</p>
  
  <p><a href="http://hg.my.com/" rel="nofollow">http://hg.my.com/</a></p>
  
  <p>with no trailing cgi-bin/hgweb.cgi</p>
  
  <p>I have gotten the following URL to work with the config given below:</p>
  
  <p><a href="http://hg.my.com/cgi-bin/hgweb.cgi" rel="nofollow">http://hg.my.com/cgi-bin/hgweb.cgi</a></p>
  
  <p>... but it doesn't access the css and images properly (unlike above perfect service)</p>
  
  <p>My config so far:</p>
  
  <pre><code>ScriptAlias /hg "/cgi-bin/hgweb.cgi"
  &lt;VirtualHost *:80&gt;
  ServerName hg.my.com
  ServerAlias hg.my.com
  
  #ScriptAlias / "/cgi-bin/hgweb.cgi"
  #  &lt;Directory /&gt;
  #   Order Deny,Allow
  #   Allow from all
  #  &lt;/Directory&gt;
  
  #        ProxyPass /stylesheets !
  #        ProxyPass /javascripts !
  #        ProxyPass /images !
  
  ProxyPassMatch ^.*/static(/.*\.css)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
  ProxyPassMatch ^.*/static(/.*\.js)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
  ProxyPassMatch ^.*/static(/.*\.png)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
  ProxyPassMatch ^.*/static(/.*\.gif)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
  
  ProxyPreserveHost On
  ProxyPass / http://localhost:91/cgi-bin/hgweb.cgi
  ProxyPassReverse / http://localhost:91/cgi-bin/hgweb.cgi
  &lt;Proxy *&gt;
    #DirectoryIndex hgweb.cgi
      #ScriptAlias / /hgweb.cgi
  # #  Order Allow,Deny
  # #  Allow from all
      Order Deny,Allow
      Allow from 127.0.0.1
      AuthUserFile C:\wamp\.htpasswd
      AuthName "Please Log In"
      AuthType Basic
  
      require user admin
      require user dev
  
   &lt;/Proxy&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Obviously I am using the time honored google-trial-and-error approach and am out of my depth here.</p>
  
  <p>Thus, my energetic egos mindless determinination for self-reliance, which otherwise seems to serve so well, now exhausted and filled with animosity toward the problem at hand -- brings me here, hat in hand, to ask:</p>
  
  <p>"Brother, can you spare a dime?"</p>