Multisite: both domains loading the default site #9144
-
Hi- We are wanting to add our own custom "link in bio" microsite within our Statamic installation that has its own domain name and resolves to a different layout and page template. I have set everything up that I can find to set up to accomplish this, yet both domains resolve to the default domain homepage. Looking for any guidance to get it working. Setup: We have had our main site hosted on our Statamic install and it's worked great. I ran the multisite command, then started configuring the additional files. Here is my statamic/sites config file now (sorry, I cannot for the life of me get it to format line breaks with the code wrapper): 'sites' => [
'default' => [
'name' => config('app.name'),
'locale' => 'en_US',
'url' => env('STATAMIC_DEFAULT_DOMAIN'),
],
'get_social' => [
'name' => 'Get Social',
'locale' => 'en_US',
'url' => env('STATAMIC_SECONDARY_DOMAIN'),
],
], I then created a new collection for pages that has a different blueprint than our main site pages. Here are the two config files for comparison. Default site: title: Pages
sites:
- default
propagate: false
template: default
layout: layouts/layout
revisions: true
route: '{parent_uri}/{slug}'
date: true
sort_dir: asc
structure:
root: true
slugs: true New Microsite: title: 'Social Pages'
sites:
- get_social
propagate: false
template: get_social
layout: layouts/social_layout
revisions: true
route: '{parent_uri}/{slug}'
date: true
sort_dir: asc
default_status: draft
preview_targets:
-
label: Entry
url: '{permalink}'
refresh: true
origin_behavior: root
structure:
root: true
slugs: true I have specified each collection to use a different layout file and default template. No matter what (yes, I have cleared all cache; no we are not using static caching), both domains load the default site layout and homepage. No errors. If anyone can spot what I am doing wrong, I'd appreciate it. If you need more info/config files/directory structures to help, I'm happy to provide them here. Thanks, -Bret |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
What are |
Beta Was this translation helpful? Give feedback.
-
@jasonvarga First, thank you for fixing my formatting. So a new element has come up. I am using Herd to host my local dev instance. The .env domains are: STATAMIC_DEFAULT_DOMAIN='https://bmc.test' I have the secondary set up as a link in Herd that points to the same root directory as the default domain. What I realized is that the URL I was accessing for the secondary domain was not https (my bad), however, when I change it to https, I get this error:
So I realize this may be an issue with Herd, however, I will say that I have both command line PHP and nginx PHP for both Herd entries set to PHP 8.2. I also made sure that Valet, which I used previously, was set to the same versions. I am thinking this is more of a local dev issue than not, but if you have any insight as to what may cause the PHP discrepancy, I am all ears. I have only seen this issue when I set up multisite, fwiw. |
Beta Was this translation helpful? Give feedback.
-
Well well well. Echo outputs 8.0.30. Both php -v and herd php -v are showing 8.2.13 I am indeed confused. Hrm. I also updated my composer.json as it had php version set to 8.0. I ran composer install after that, but it did not fix the issue. I also tried just rebuilding the composer.lock file, but it remains showing PHP 8.0 in the lock file: "require": {
"php": "^8.0",
"statamic/cms": "^4.0"
}, Not sure if that is the cause, but it would seem to point in that direction. For what it's worth, the primary domain echoes the correct PHP version. |
Beta Was this translation helpful? Give feedback.
-
@jasonvarga It would seem others are running into similar behavior with Herd: Feel free to close this ticket, as it would seem to not be Statamic related. Thank you for your help and time, and sorry for the misdirection! |
Beta Was this translation helpful? Give feedback.
@jasonvarga It would seem others are running into similar behavior with Herd:
beyondcode/herd-community#203
Feel free to close this ticket, as it would seem to not be Statamic related. Thank you for your help and time, and sorry for the misdirection!