Configuring Cloudflare IP Geolocation

Hi,

I want to use Cloudflare IP Geolocation for my customer:
I have website for example: www.x.com (this is the default url)

he wants to redirect page by this rules:

  1. who comes for UK redirect to www.x.com/uk/

How can I do it?

Simplest way if you have access to the backend is to rewrite the URL based on the header ‘CF-IPCountry’ (the usual ISO 3166-1 Alpha 2 format) passed in the request header.

Arguably better to use a Cloudflare Worker but depends if you want to bring more technology components into the mix. Might not be worth it unless you manage their whole stack.

1 Like

I don’t have access to backend.
I want to do it only from control panel page rules from Cloudflare there is a simple way or guide to do it?

Not something you can do with a Page Rule, no.

However this is easily achievable with a Cloudflare Worker script - in fact it’s even one of their example uses:

You can just tweak that to suit.

3 Likes

This topic was automatically closed after 14 days. New replies are no longer allowed.