One WordPress Site for Two Markets: Building UK and US Journeys Behind a Page Cache
How I gave a London law firm one WordPress site with a separate journey for US companies: region-aware menus with no flash of the wrong menu, no forced redirects, clean hreflang, and all of it working behind a page cache.
On this page
Some businesses sell to two audiences, and one website has to talk to both.
That was the brief from a commercial law firm in London. It advises UK businesses, and it also helps US companies expanding into the UK. A UK client wants contracts and privacy advice. A US founder wants to know how to set up in the UK, move staff over and sign English-law contracts.
This post is the technical side of that project: how one WordPress site serves both journeys, why the obvious approaches don't work behind a page cache, and what I'd tell anyone building something similar. The full story of the project is in the case study.
Two websites, or one?
The first question is whether to build two sites. It sounds simpler, but it doubles everything: two sets of updates, two sets of plugins, two places for content to drift apart. The firm also wanted to edit everything itself.
So the US experience became a section of the same site, under /us/. Same theme, same Elementor design system, same editing tools. Different pages and different menus where it matters.
The founder gave me the rule that decided the structure, and I'd now use it on any multi-market site:
Only create a separate version of a page when the content and the buying journey are materially different.
That gave three kinds of page:
| Page type | Examples | Why |
|---|---|---|
| US-only | US homepage, UK Expansion, UK Business Immigration | Only a US company needs them |
| Paired | Commercial Contracts, Privacy & GDPR | Both audiences need them, but the content differs |
| Shared | About, Contact, Insights, legal pages | The same for everyone |
The US pages live at addresses that explain themselves, such as /us/uk-expansion/, /us/uk-immigration/ and /us/commercial-contracts/.
The hard part: shared pages
US-only and UK pages are easy: the page knows which journey it belongs to.
Shared pages are the problem. A US founder who clicks About from the US homepage lands on the one About page. That page still has to show the US menu: the US version of How We Help, and a logo that leads back to /us/. A UK visitor opening the same page should see the UK menu.
This bug showed up in the first review. The founder chose the US homepage, clicked through to an inner page, and found themselves back in the UK site. It was a fair catch: the menu was following the page, when it needed to follow the visitor.
Why the server can't decide
The obvious fix is to decide the region in PHP and print the right menu. On this hosting, it fails.
The host runs a page cache. The first visitor to a page causes WordPress to build the HTML, and the cache sends that same HTML to everyone after them. If the server picked the menu, whoever happened to load About first would decide the menu for every visitor until the cache cleared.
You can work around this with cache variations by cookie, but that depends on the host's cache supporting it, and it multiplies cached copies. I wanted something that works on any cache.
What I did: both menus, one attribute
The page carries both menus in its HTML, and a tiny script decides which one is visible before anything is drawn.
The script runs in the <head> and works out the region in this order:
- If the page belongs to a region, use it. Any
/us/page means US. A UK page means UK. - Otherwise, use the visitor's last region, saved in
localStorage. - If there is nothing saved, default to UK.
It then sets an attribute on the <html> element, and CSS hides the menu that doesn't match. A simplified sketch of the idea (not the production code):
<script> (function () { var root = document.documentElement; var pageRegion = root.getAttribute('data-page-region'); // "uk", "us" or "shared" var region = pageRegion !== 'shared' ? pageRegion : (localStorage.getItem('region') || 'uk'); localStorage.setItem('region', region); root.setAttribute('data-region', region); })(); </script>
[data-region="uk"] .menu-us, [data-region="us"] .menu-uk { display: none; }
Three details make this work:
- It runs before the first paint. The script sits in the head, so the browser never draws the wrong menu and then swaps it. There is no flicker.
- Visiting a page sets the region; shared pages keep it. Open any US page and you are a US visitor from then on. Open a UK page and you are a UK visitor. A shared page keeps whatever you already were.
- The cached HTML is identical for everyone. The cache can serve one copy of each page to every visitor, because the choice happens in the browser.
Letting people choose
The founder was firm about one thing: nobody should ever be forced into a region. Visitors and search engines must always be able to reach both versions.
So there are no IP redirects. A selector in the header lets anyone switch between UK/International and US at any time, and the choice is remembered.
I also tried a small popup that looked up the visitor's country with IPinfo and suggested the US version to US visitors. In the end we dropped it and kept the switch in the header, where it is always visible.
Keeping search engines happy
Region sites can cause SEO problems if they are set up carelessly. The rules I followed:
- Content depends on the URL, never on the visitor. Google always gets the same page at the same address. The visitor's stored region only changes which menu is visible.
- hreflang only on paired pages. The UK and US Commercial Contracts pages point to each other with
hreflang, so Google can show the right one in each country. US-only and shared pages don't need it. - Self-canonical URLs on shared pages, so About isn't treated as duplicate content.
- Clean, descriptive URLs for the US journey, so a search result explains itself before anyone clicks.
Every page also has a proper Yoast title, description and Open Graph image.
Keeping it editable
All of this would be fragile if it depended on hand-written HTML. Every section of the site is a native Elementor container or widget, linked to the global colours and type. There are no Custom HTML blocks. The two menus are ordinary WordPress menus, so the firm can change a link in the US menu without touching any code.
The result
The site launched with 18 pages across the two journeys. A US founder can move from the US homepage to About, Insights and Contact and never lose the US menu. A UK client never sees immigration services they don't need. And the whole site sits behind the host's page cache.
If you're building a multi-market site
- Write down which pages differ by market before you design anything. Most don't.
- Decide where the region lives. If you use a page cache, the visitor's choice belongs in the browser, not on the server.
- Never force a redirect. Suggest, or let people choose, and remember the choice.
- Keep content tied to URLs so search engines see a stable site.
- Test the shared pages, because that is where region logic breaks.
Thinking about a site for more than one market?
If your business serves more than one market, you probably don't need a separate website for each. Get in touch and I'll tell you what would work for yours.