<p>I have Ingress</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  labels:
    app.kubernetes.io/managed-by: Helm
  annotations:
    kubernetes.io/ingress.class: nginx
    meta.helm.sh/release-name: ingress
    nginx.ingress.kubernetes.io/configuration-snippet: |
      location ~ favicon.ico {
        log_not_found off;
      }
    nginx.ingress.kubernetes.io/cors-allow-headers: content-type, x-att-timezone
    nginx.ingress.kubernetes.io/cors-allow-methods: GET, POST, PUT, DELETE, OPTIONS
    nginx.ingress.kubernetes.io/cors-allow-origin: '*'
    nginx.ingress.kubernetes.io/cors-expose-headers: 'x-att-userrole, x-att-userdetails, x-att-userid, xatt-location '
    nginx.ingress.kubernetes.io/enable-cors: 'true'
    nginx.ingress.kubernetes.io/force-ssl-redirect: 'true'
    nginx.ingress.kubernetes.io/proxy-body-size: 10000m
    nginx.ingress.kubernetes.io/proxy-connect-timeout: '6000000'
    nginx.ingress.kubernetes.io/proxy-read-timeout: '6000000'
    nginx.ingress.kubernetes.io/proxy-send-timeout: '6000000'
    nginx.ingress.kubernetes.io/use-regex: 'true'      
spec:
  tls:
    - hosts:
        - st-my-doamin.com
      secretName: ingress
  rules:
    - host: st-my-doamin.com
      http:
        paths:
          - path: /rootpath/.*
            pathType: Prefix
            backend:
              service:
                name: someService
                port:
                  number: 80
</code></pre>
<p>And i want to create redirection like this :</p>
<p>if i go to st-my-doamin.com/rootpath i will be <strong>redirect</strong> to st-my-doamin.com/rootpath/login</p>
<p>i tried to create this redirection and got error :</p>
<pre><code>This page isn’t working st-my-doamin.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
</code></pre>

<p>As you are getting the error &quot;ERR_TOO_MANY_REDIRECTS&quot; follow this <a href="https://kinsta.com/blog/err_too_many_redirects/" rel="nofollow noreferrer">link</a> it helps in clearing this error. Follow this <a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="nofollow noreferrer">Link</a> in redirecting the Path.</p>
<p>Add the below annotation in yaml :</p>
<pre><code>nginx.ingress.kubernetes.io/rewrite-target: /get_similarity/$2
</code></pre>
<p>And add Path as below:</p>
<pre><code>  - path: /rootpath(/|$)(.*)
</code></pre>
