title: routing wildcard domain to different paths in nginx ingress
body: <p>how do I achieve something similar to this.</p>
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    annotations:
      kubernetes.io/ingress.class: nginx
      ingress.kubernetes.io/rewrite-target: /c/{word-maching-wildcard}
  
    name: some-route
    namespace: prod
  spec:
    rules:
       - host: &quot;*.example.com&quot; # {hello}.example.com -&gt; hello.example.com/hello
         http:
          paths:
           - backend:
              serviceName: svc
              servicePort: 8080
             path: /
  </code></pre>
  <p>Is there any way to capture the matching word in the subdomain and append it in the path before routing to the upstream service.</p>