Rewrite to ExternalName service isn't working

I’ve a virtual service listening for a host, rewriting the path and sending it to host mytestsvc. In this case mytestsvc is an externalName type service pointing to a service running outside the cluster.
I’m getting the request on my service running outside the cluster, so redirect is happening but path rewrite isn’t happening. request is coming for /restsql instead of /api/ms/demo/
What’s the right way to achieve this?
following is the virtual service:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: restwrapjdbc
  namespace: test
  labels:
    app: demo
spec:
  hosts:
  - restwrapjdbc
  http:
  - match:
    - uri:
        prefix: /restsql
    rewrite:
        uri: /api/ms/demo/
    route:
    - destination:
        host: mytestsvc
        port:
          number: 80

Following is the Extenamename service mytestsvc:

apiVersion: v1
kind: Service
metadata:
  name: mytestsvc
  namespace: test
spec:
  type: ExternalName
  externalName: test.com