0

I have a multisite and multilanguage setup (craft 3).

SiteADe => siteA.com/de
SiteAFr => siteA.com/fr

SiteBDe => siteB.com/de (primary site)
SiteBFr => siteB.com/fr
etc.

ALL sites have a language identifier.

On my server I configured each website to the same directory and files.
So there's only one .env file and general.php for all websites.

The first structure entry of each website has "__home__" as slug.

All sites should be redirected to their language identifier.
e.g. siteA.com should be redirected to siteA.com/<browserlanguage>

Problem with this setup: Everything works as expected as long as the language identifier is in the URL.

Problem begins if there's no language identifier in the URL:
Craft will only work properly on the primary site.

E.g. a sitemap.xml file will always be redirected to the primary site.
404 Errors are only displayed on the primary site. e.g. siteA.com/daksdf

I've managed to get around this by placing some hacky twig code within the __home__ template.

Anyways: I suspect that I'm taking the wrong approach on this.

How would I best setup my (web)sites?

And how would I forward them to /<browserlanguage>?

Any help appreciated!
Stefan

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.