Redirect Users based on their Location

Hi,

I have a domain called www.example.com, When the users who are in USA IP addresses visits to my site, I want them to redirect to www.usa.example.com domain.

I tried Redirect URLs, but its not working.

Please advice me, how can I do that?

A redirect rule (using “Country” as a field) or a using a Worker should work.

But, your target is www.usa.example.com which is a second-level domain. Cloudflare’s Universal SSL certificate will only cover example.com and *.example.com so going to www.usa.example.com will give a certificate error in the browser.

You either need to use an Advanced Certificate for www.usa.example.com or set the target to be something like usa.example.com or www-usa.example.com.

I already hosted a shopify store to that domain. So, shopify is offering free SSL for that domain.

Is www.example.com also hosted on Shopify? If so, your requests are going direct to Shopify’s Cloudlfare account (your DNS record will be DNS only) so no rules set in your Cloudflare account can have an effect.

If not on Shopify, then can you show a screenshot of the redirect rule?

If the DNS settings are on DNS Only, can’t we do the redirection part?

No, as requests don’t pass through your Cloudflare account.

You’ll need to see if there’s an option on Shopify to do what you want.

Okay I will check that. Thanks

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.