craftcms / craftcms/cms

[5.x]: Multi-Site setup: Craft loads content from the wrong Site Group.

Open
#16,902 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

I've got a multi site setup with different site groups.

Setup:

Group 1 has these sites:

Site 1 EN (primary), Base URL: site1.com
Site 1 FR, Base URL: site1.com/fr
Site 1 NL, Base URL: site1.com/nl

Group 2 has these sites:

Site 2 EN, Base URL: site1.be/en
Site 2 FR, Base URL: site2.be/fr
Site 2 NL, Base URL: site2.be

Expected behavior

On all 3 sites in group 2 the content gets loaded from the right site.

Actual behavior

On Site 2 FR the content gets loaded from Site 1 FR. Site 2 NL only works because there is no language in the Base URL.

Printing the currentSite.group on Site 2 FR prints Group 1, this should be Group 2.

Also: changing the path of Site 2 FR to 'fr1' fixes the issue. Seems like Craft cannot distinguish different sites with different domain/same language path.

Happy to send db, project files etc through mail if needed.

Craft CMS version

Craft Pro 5.6.11

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the multi-site configuration described, especially Site 2 FR with the shared language path, and inspect how currentSite.group and content site resolution are determined. Done means Site 2 FR resolves to Group 2 and loads its content without requiring a changed path; compare this with Site 2 NL and the working alternate-path case.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.