Skip to content

Commit 745aa57

Browse files
Christian Shearerclaude
andcommitted
Add language code redirects for /is → /es and other common variants
Adds 301 redirects for commonly confused or regional language codes: /is → /es, /br → /pt, /mx → /es, /cn → /zh, /tw → /zh, /in → /hi Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 17e2949 commit 745aa57

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/server/routes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,14 @@ ${betaBannerJS()}
850850
});
851851
}
852852

853+
// Common language code redirects for unsupported variants
854+
const LANG_REDIRECTS: Record<string, LangCode> = { is: "es", br: "pt", mx: "es", cn: "zh", tw: "zh", in: "hi" };
855+
for (const [from, to] of Object.entries(LANG_REDIRECTS)) {
856+
router.get(`/${from}`, (_req: Request, res: Response) => {
857+
res.redirect(301, `/${to}`);
858+
});
859+
}
860+
853861
// --- Stripe-dependent routes (only registered when Stripe is configured) ---
854862
if (stripe) {
855863

0 commit comments

Comments
 (0)