Path variable mapping

How can i achieve the following scenario with kong.

uri: /abc/xyz/123
strip_uri: true
upstream_url: api
expected request from kong : api/xyz/123

uri: /abc/xyz/123/uvw/123
strip_uri: true
upstream_url: api1
expected request from kong : api1/xyz/123/uvw/123

Regards,
Prasad