Redirect visitors based of country

Hello there,

I have a hard time trying to create country-based redirection for my website.
So far I have found these 2 tutorials:


But it is not working for me.
I have a clean cache!

Transform rule: ``
Page rule: ``

Here is a worker:  `` but it does not redirect me do if I visit a website from Croatia or Bosnia.



None of your print links are working, they all point to a parked domain, so we can’t see your rules. Please copy and paste your rule expressions instead of screenshots. This makes it easier for other users to suggest a fix.

The first YouTube tutorial was created before Redirect Rules, but, since they are now available, instead of creating a Transform Rule and a Page Rule, you should just create a Redirect Rule based on country of origin.

You should test one method at a time. If you prefer using Redirect Rules (easier), you should remove any Worker routes so that we can troubleshoot your rules. If you prefer the Workers instead of Redirect Rules, please post the content of your Worker, with preformatted text so members of this community can review it.

Hello there,

CF was paused on this web site and that makes a problem. Redirection now is working, but:

  • If i use redirect rule with this expression: concat(“/archive”, http.request.uri.path) (image bellow)

And visit link from Bosnia, user will not redirect to, instand user will be redirect to something like:

  • if I use CF country redirect example worker:

And visit, it will not redirect me to, instad it will redirect me to just

Can you pleas help me update a code?


To avoid the loop you’re seeing, you need to redirect only if the requested path does not already have “/archive”. So your expression should look like:

( in {...}) and not starts_with(http.request.uri.path, "/archive")

It look like worker redirect is little bit faster?

How we can modifly code to do same?


Hello there,

In my situation, this will not work.


The target needs to be a “simple” URL or a “dynamic” expression that builds one. You have a condition which just evaluates to true or false.

Look at some examples here or post what you want to redirect to.


I will like to redirect users from Bosnia and Serbia to serbian version of website.
But i will like to save user current page, for example if user from Bosnia visit domain .com/contact i will like to redirect him to domain .com/archive/contact (not domain .com/archve).


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