URL & Routing
Flexible URL structures and automatic language detection for every visitor.
Flexible URL Structures
Choose between subdirectory, subdomain, per-language domain, or a query-parameter (?lang=) layout. Subdomain and per-language domain modes carry the language in the hostname, so they work with any permalink structure; subdirectory mode shines with pretty permalinks (Plain permalinks work too, as long as your server routes every path to WordPress). The query-parameter mode (?lang=de) works with every permalink structure — including Plain — on any server, and always keeps the default language on clean URLs.
Automatic Language Detection
Detect visitor language using a configurable priority chain: URL prefix, cookie, browser language, or GeoIP geolocation. PerfLocale walks the chain in order and stops at the first match — no extra lookups once a language is found.
198.51.100.42 · no language cookie- perflocale/geo/lookup_country Return a country code
- perflocale/geo/providers Register an HTTP provider
DE → DeutschGeoIP Redirect
Redirect first-time visitors to their local language based on the country they're browsing from. PerfLocale bundles no geolocation service and contacts no third party on its own — you decide where the country code comes from. If your CDN already sends one (Cloudflare's CF-IPCountry, for example), returning it from perflocale/geo/lookup_country is a one-liner; otherwise register an HTTP provider through perflocale/geo/providers. PerfLocale handles the country → language mapping, the redirect, and the caching.

Language Fallbacks
Set an ordered fallback chain per language. When a visitor requests a page that hasn’t been translated yet, PerfLocale walks the list and issues a single redirect to the first published sibling — never a chain of hops. If nothing in the chain matches, the global Missing Translation Action takes over. Read the language-fallback docs.
Self-Healing Rewrite Rules
PerfLocale watches WordPress’s URL routing and rebuilds it the moment something drifts. Pretty URLs never 404 from a stale cache — no manual Save Permalinks trips.