TL;DR
?no_redirect=1 to your switcher links so a deliberate choice is honored, and (2) make the redirect fire once per sessionso normal clicking around isn't re-routed. The popular "wrap the script in localStorage" hack usually breaks because it gates whether the script loads at all.This is one of the most frustrating geo-redirect problems, and a real one teams hit with tools like Geo Targetly on HubSpot: you set up country redirects, everything works — until someone notices that the manual language switcher is useless. A visitor in Germany clicks "English," lands on the English page for a split second, and the geo-redirect immediately sends them back to German. The two systems are fighting, and the visitor loses.
Why it happens
A geo-redirect re-evaluates on page load. It doesn't know whythe visitor is on a given page — only where they appear to be. So when the switcher takes a German visitor to the English page, the next evaluation sees "country = DE, on a non-German page" and dutifully redirects them back. From the script's point of view it's working perfectly. From the visitor's point of view the switcher is broken. The redirect simply has no concept of "this person already made a choice — stand down."
Why the localStorage hack breaks
The common DIY fix is to wrap the geo script in logic: set a flag when a switcher link is clicked, and only run the redirect if the flag isn't set. It's the right instinct, but it breaks in two predictable ways that show up all over the Community.
- Backwards load condition. A small logic slip — loading the script only whenthe switcher was used instead of when it wasn't — means the redirect never runs for normal visitors at all. The reported symptom: "it blocked the geo code altogether."
- Persistent flag, no reset.
localStoragesurvives across sessions. Once the "switched" flag is set, it stays set — so the visitor (and the redirect logic keyed on that browser) never gets geo-routed again, even on a fresh visit weeks later. The reported symptom: "when I start a new session it doesn't load for that country."
The deeper problem is that gating whether the script loadsis a blunt instrument. You don't want to disable geo-redirection forever — you want it to politely skip a visitor who just made an explicit choice. That calls for two precise mechanisms, not one global on/off switch.
The fix, part 1: a bypass parameter on switcher links
Give the redirect an explicit "not this time" signal. Add a query parameter to every language/region switcher link — for example /en/pricing?no_redirect=1— and have the redirect script skip evaluation whenever it sees that parameter. Now a deliberate switch is never undone: the visitor asked for English, the link says "don't redirect," and they stay on English. This is targeted: it only suppresses the redirect for that intentional navigation, leaving everything else normal.
What the switcher links should look like
Instead ofhref="/en/", your English switcher link becomes href="/en/?no_redirect=1" (and the German one /de/?no_redirect=1, etc.). One attribute per link, no script gymnastics.The fix, part 2: fire once per session
The bypass handles the explicit switch; once-per-session handles everything after it. A well-behaved geo-redirect remembers (in sessionStorage, not localStorage) that it has already acted this session, and doesn't re-route the visitor as they click around. Session scope is the key difference from the broken hack: it resets naturally when the visitor returns later, so you get "route new arrivals, then leave them alone" without the permanent-flag problem.
Together these two behaviors resolve the conflict completely: new visitors get sent to their region once, anyone who uses the switcher is honored immediately, and nobody gets trapped in a loop.
How to test the fix
Conflicts like this hide until a specific sequence reproduces them, so test deliberately rather than clicking around once and calling it done:
- Fresh session, get redirected.Open your site in a new incognito window from a location (or simulated country) that has a rule. Confirm you're routed to the right region — that proves the redirect still fires for new arrivals.
- Use the switcher, confirm it sticks. Now click your language/region switcher to a different version. You should land there and staythere — no bounce back. If you get pulled back, the bypass parameter isn't on the switcher links.
- Click around after switching. Navigate to a few other pages. You should not be re-routed mid-session — that confirms once-per-session behavior is working.
- Return in a new session. Close the window, open a fresh one. A new arrival should be evaluated again — confirming the state was session-scoped, not a permanent
localStorageflag that disables routing forever.
Run those four steps and you've covered every state the redirect/switcher interaction can be in.
The takeaway: this should be built in
If you find yourself wrapping a geo-redirect script in custom localStorage logic to stop it fighting your switcher, that's a sign the tool is missing table-stakes behavior. A bypass parameter and once-per-session firing aren't advanced features — they're what separates a geo-redirect that helps visitors from one that traps them. Easy Redirects ships both by default: redirects fire once per session automatically, and ?no_redirect=1on any URL (including your switcher links) bypasses the rules — no script wrapping required. The switcher and the redirect stop fighting because the redirect was designed to yield to a visitor's explicit choice.
Geo-redirects on your HubSpot site in 5 minutes
One script tag, no code, no DNS changes. Free plan included.
Start freeFrequently asked questions
Why does my geo-redirect override the language switcher?
Because it re-evaluates on the next page load and still sees the visitor's country, so it routes them back to the regional version — undoing their manual choice. The redirect needs a way to know 'this person already chose; leave them alone.'
Why did wrapping the geo script in localStorage logic break it?
Two reasons people hit: the script then only loads when the switcher was used (backwards logic), or the flag persists across sessions in localStorage so the redirect never runs again for anyone, even brand-new visits. Session-scoped state and a per-link bypass are more reliable than gating whether the script loads at all.
What's the cleanest fix?
Add a bypass parameter (e.g. ?no_redirect=1) to your language switcher links so a deliberate switch is never undone, and make the redirect fire only once per browser session so normal navigation isn't re-routed. Good geo-redirect tools support both out of the box.
Will visitors get redirected again next time they come back?
With session-scoped behavior, a returning visitor in a new session is evaluated fresh — which is usually what you want. If you need the choice to persist longer, store the preference and have the switcher links always carry the bypass flag.