Blog
Geo-targeted links: one URL, a different page per country
How country routing on a short link actually works — where the country comes from, why it is only ever a country, and the four ways teams get it wrong.
By Wasim Idrishi · Updated · 4 min read
The support ticket that starts this is always the same shape: a customer in Germany was quoted in rupees, or a customer in India was shown a page that does not ship to India. Someone then proposes putting three links in the email, one per region, and the campaign quietly loses the people who pick wrong.
One link that routes by country fixes it, provided you understand exactly what the country is.
Where the country comes from
It is a header. The network edge in front of the application resolves the visitor's IP address to a country
and attaches the two-letter code to the request; we read that header, uppercase it, and compare it to your
rule list. On our infrastructure that header is CF-IPCountry, and the deployment also understands the
equivalent Vercel header.
Two consequences follow, and both matter more than the feature itself.
We never see or store the address. The redirect path takes the header, and the IP itself lives only in memory long enough to compute a rate-limit key and a daily-salted visitor hash. There is no geolocation database on our side to be stale.
And the code is only ever a country. Regions and cities do get recorded on the click, and they show up in your analytics, but routing decisions read the country field alone. Edge region data is good enough to tell you that most of your traffic came from Maharashtra; it is not good enough to send someone to a different shop because of it.
How the rules are evaluated
A link holds up to 20 geo rules. Each one is a list of up to 50 ISO 3166-1 alpha-2 codes and one destination URL. The first rule whose list contains the visitor's country wins, and evaluation stops there.
| Order | Rule | Matches on | Recorded as |
|---|---|---|---|
| 1 | Country | Two-letter code from the edge header | geo:IN, geo:DE, … |
| 2 | Device | iOS, Android or desktop from the user agent | device:ios, … |
| 3 | A/B split | A stable bucket per visitor per day | ab:A, ab:B, … |
| 4 | Default | Nothing matched | no variant |
Because country is first, a link with both a geo rule for India and a device rule for iOS will always send an Indian iPhone to the India URL. That surprises people. If you need both dimensions, the device split belongs inside the page you send India to, not next to the geo rule.
The four ways this goes wrong
Rule order written as a list of exceptions. Rules are matched, not layered. Put the specific list first only in the sense that a country appearing in two rules is decided by whichever rule you wrote earlier — a country in two lists is a bug, not a priority.
Routing to a page that then redirects again. Your country page redirects to a locale path, which redirects to a trailing-slash variant. Three hops on a mobile network is a visible pause. Trace the chain before you publish.
Treating the default as an error page. Everyone whose country is unreadable — corporate VPNs, some satellite and carrier networks, privacy browsers — lands on the default. Make it the page that works for the largest group, not a "choose your region" wall.
Forgetting the destination's own logic. Many storefronts geo-redirect on their own. A link that sends
Germany to /de and a shop that sends German IPs to /de-DE produces a loop or a double redirect. Decide
which layer owns the routing and turn the other one off.
Redirect Checker
Open the full toolWhat you get back
Every click records country, region and city alongside the usual device, referrer and campaign fields, and
when a geo rule fires it also records the branch as geo: plus the country code. The variant breakdown then
tells you how much traffic each rule actually served, which is the number that shows whether a rule was
worth writing.
Two readings are worth the minute. A rule serving under about two per cent of clicks is usually not paying for the maintenance. And a country appearing high in the country breakdown with no rule pointing at it is the next rule to write.
Geo targeting is a Business feature. It applies to the same branded links as everything else, so the alias stays yours, the QR code stays printed, and the destination behind each rule stays editable after the campaign ships.
Questions people ask
Where does the country come from?
A header the network edge adds to the request before it reaches us, based on the visitor's IP address. We read it, uppercase it and match it against your rule list. We never store the address it was derived from, and we do not run a lookup ourselves.
Can I target a city or a region?
Not in rules. Region and city are recorded on the click and appear in analytics, but routing decisions are made on the two-letter country code only. A city rule would be a promise the edge data cannot keep.
What happens if the country is unknown?
The geo rules are skipped entirely and evaluation moves on to device rules, then any A/B split, then the link's default destination. A visitor whose country we cannot see always gets a working link.
Can one rule cover several countries?
Yes. Each rule holds up to 50 country codes pointing at one URL, and a link can carry up to 20 rules. Put your whole EU list in one rule rather than writing 27.
Does geo routing break my QR codes?
No. The QR encodes the short link, not the destination, so the same printed code resolves per visitor. This is the main reason to print a short link rather than a country-specific URL.
Sources
- ISO 3166-1 alpha-2 country codes — checked 5 September 2026
Keep going
Try it with your own link
Paste a long link and get a 10-character gc.mw link with a QR code. No account needed for 30 days; free forever with one.