Help With workers redirect for country

Hello ,
Any one have idea or the worker code to force redirect some country from www.domain.com to subdomain.domain.com , my website runing on apache + ea-nginx reverse proxy (cpanel).
i have tried to contact with cloudflare support for this option since my account and domain running with pro plan but they have reply me , that is the support is limited and they cant provide support for such service which is this service is already paid and it must be have support since its paid , but any way the last hope is to get the way to do it here.
Thanks for everyone provide real help.
Regards

Thanks bro , its not working with me since im using nginx as a reverse proxy and rewrite cond not working i think , im wondering about how to apply it on cloudflare side (Workers).

there is some link : Redirecting specific country to sub domain

maybe will be useful for my case since im looking for redirecting
https://www.domain.com/folder/file.php?=string
To be
https://sub.domain.com/folder/file.php?=string
for specific country not all country’s,
i need the code to be working with cloudflare workers
please any one can help send me the correct code :frowning:

Here’s a link which might help.


And secondly a converter to help. You may need to tweak the automatic conversion, but it might be a step in the right direction.
https://winginx.com/en/htaccess