Multiple domains and languages on the same Next.js site
This is an example of hosting multiple domains on the same Next.js site (while maintaining multiple languages and static site generation (SSG)), using Next.js’ i18n system.
Demo
https://multi-domain-locale1.vercel.app/
Concept
- Next.js’ i18n
localeis used to determine the site. - Selecting a language is instead handled via a
pseudoLocaleprop (pages in a/[pseudoLocale]folder). - A redirect from
/to/en. - TODO: Automatic language detection using the Accept-Language header.
See next.config.js for setup.