title: Proxy Apache to Tomcat via a subdomain, using mod_jk, hiding the path in the url
body: <p>I have an Apache and a Tomcat running on my Debian server, Apache using mod_jk for proxying requests to Tomcat and back. I installed Jenkins inside the Tomcat. Setup worked fine, proxying is working, too. </p>
  
  <p>Now i simply have a problem with my rewrite rules (I think). </p>
  
  <p>What I <em>have</em> is:
  <code>ci.&lt;mydomain&gt;.com/jenkins</code></p>
  
  <p>What I <em>want</em> is:
  <code>ci.&lt;mydomain&gt;.com</code></p>
  
  <p>I'm not experienced enough with the rewrite rules in Apache and documentation / google doesn't help me either (probably I'm not using the right key words).
  So any help is appreciated. </p>
  
  <p>Here is my setup:<br/>
  Apache version: Apache/2.2.16 (Debian)<br/>
  Tomcat version: Apache Tomcat/7.0.27</p>
  
  <p>my <code>worker.properties</code> file looks like this:</p>
  
  <pre><code># Define 1 real worker using ajp13
  worker.list=worker1
  # Set properties for worker1 (ajp13)
  worker.worker1.type=ajp13
  worker.worker1.host=localhost
  worker.worker1.port=8009
  </code></pre>
  
  <p>Definition of my subdomain / Virtual host:</p>
  
  <pre><code>&lt;VirtualHost *&gt;
    ServerName ci.&lt;mydomain&gt;.com
    ServerAlias www.ci.&lt;mydomain&gt;.de
  
    ErrorLog /var/log/apache2/ci_error.log
    LogLevel warn 
    CustomLog /var/log/apache2/ci_access.log combined
  
    JKMount /jenkins/* worker1
    JKMount /jenkins worker1
  
    RewriteEngine on
    RewriteRule ^/$ /jenkins/ [R=permanent]
    RewriteRule ^/jenkins/(.*)$ ajp://localhost:8009/jenkins/$1 [P]
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Jenkins is just one app I want to be served by Tomcat. Most of the other applications will have their own Virtual Host, too. As far as I understood the mod_jk stuff, this worker should be enough for all of my other applications, but maybe I'm wrong. </p>
  
  <p>As I can access Jenkins through the subdomain already, I think it's (as mentioned before) just a matter of correct rewrite rules. </p>
  
  <p>Any help is appreciated and I'm thankful for any advice or hint :)</p>