Country Redirect To Sub-Domains

I have subdomains point to same root, when user enter the main domain redirected to subdomian depending on

his country location ex :

1- user enter www.example.com

2- detect country = italy

3- redirected to subdomain www.it.example.com

and thank you .

Hi

what is your issue ? Do you want to know how detect a country ?

or how to redirect after of detecting ?