Skipping subfolder while using Country redirect using Workers

Hello Everyone …!!

I am looking for some help here and will appreciate if anyone could point me in right direction please :slight_smile:

I am trying to use Workers for Country code redirect, which will redirect visitor to respective country TLD domain. I have referred to Country code redirect · Cloudflare Workers docs which is working as expected.

For eg, my domain name is abc.com. If a visitor from UK browses my website, he should automatically see abc.co.uk.
This is working very well.

However, the problem is with a few sub-folders (not all), where even they are redirecting.

For eg, abc.com/support is the link of subfolder. Is there any way possible to skip certain subfolders such as /support in this country redirect, so that a person from UK if he accesses main website abc.com, he should be able to access abc.co.uk, but when accessing subfolder, he should be able to access abc.com/support.

Please note, with above workers in place, it changes to abc.co.uk/support and it results in 404 error, as /support resides only on .com website.

Any expert advise please?

Thank you in advance !! cheer!

Was wondering if anyone could help me please?