title: Varnish 4 rewrite URL transparently
body: <p>I am looking after a website that is currently running a pretty standard varnish/apache set up. The client needs to add a new domain that transparently serves from a path/query string in order to create a lightweight version of their site. For example:</p>
  
  <p>The user visits mobile.example.com which points to the same server as example.com</p>
  
  <p>Varnish rewrites the mobile.example.com request to example.com/mobile?theme=mobile</p>
  
  <p>User receives the page served from example.com/mobile?theme=mobile by apache, but stays on mobile.example.com</p>
  
  <p>We need to hit both a path and add the query string here, as well as maintain any path the user has entered, i.e: mobile.example.com/test should serve the content at example.com/mobile/test?theme=mobile</p>
  
  <p>Any tips for doing this with Varnish 4? Is it possible?</p>