Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
angelokeirsebilck opened this issue Mar 17, 2025 · 3 comments
Labels

Comments

@angelokeirsebilck
Copy link

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

@i-just
Copy link
Contributor

i-just commented Mar 17, 2025

Hi, thanks for getting in touch! I used the information in this issue, along with the extra information you provided on Discord, and I’m not able to reproduce it.

Can you please send your composer.json, composer.lock, .env, and config/general.php files and the database export to support@craftmcs.com so we can try to reproduce and dig deeper?

@brandonkelly
Copy link
Member

Create a template with the following in it:

{{ craft.app.request.hostName }}

Is it outputting the expected host name when you access the template from each of the host names (site1.com, site2.com)?

Also, check your project files for CRAFT_SITE and currentSite. Either of those getting set anywhere? Places to look include:

  • web/.env
  • web/index.php
  • bootstrap.php
  • config/app.php
  • config/app.web.php (if it exists)

@angelokeirsebilck
Copy link
Author

I could not find any code where we set CRAFT_SITE or currentSite.

Outputting the hostname does give me the correct host: site1.com ,site2.be.

I've sent DB and project files to support@craftcms.com yesterday through wetransfer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants