Varnish 4 rewrite URL transparently
snippet in htaccess

Varnish 4 rewrite URL transparently

user4628

if (req.http.host ~ "^mobile\.example\.com") {
  set req.http.host = "example.com";
  set req.url = regsub(req.url, "^/", "/mobile/");
  set req.url = regsub(req.url, "$", "?theme=mobile");
}