title: Kubernetes Ingress redirect to a directory
body: <p>using ingress example in kubernetes. I've been trying to browse but couldn't understand how to rewrite ingress to take a file which needs from the website with the ingress object in kubernetes from a folder</p>
  
  <p>Here is the example:</p>
  
  <pre><code> apiVersion: extensions/v1beta1
      kind: Ingress
      metadata:
        annotations:
          nginx.ingress.kubernetes.io/rewrite-target: /$1
        name: tomcat-ingress
        namespace: default 
      spec:
        rules:
        - host: rewrite.bar.com
          http:
            paths:
            - backend:
                serviceName: tomcat-deployment-service
                servicePort: 8080
              path: /tomcat/?(.*)
            - backend:
                serviceName: nginx-deployment-service
                servicePort: 80
              path: /nginx/?(.*)
  </code></pre>
  
  <p>AND here how is done in our local nginx server:</p>
  
  <pre><code>  location ~* /company/logo/[0-9]*/.*\.(jpg|jpeg|gif|png)$ {
                  root /opt/comapny/docs-branch/;
                  rewrite /company/logo/([0-9]*)/(.*) /$1/$2 break;
  </code></pre>
  
  <p>I'm trying to figure out how when accessing this endpoint to redirect to a folder so it can take its file when needed. Also shall it try to access them from the nginx controller pod or the pod that has the service with the ingress</p>