The case:
I have multiple domains: A,B,C with pointers to domain D.
Domain D has Grav with folder user/sites/A; user/sites/B; user/sites/C; user/sites/D;
The theme, plugins folders for ALL domains are the same, everything else is different: pages, config, etc.
What is the correct setup.php?
Currently i have, but not working:
<?php
use Grav\Common\Utils;
// Get subsite name from sub-domain
$environment = isset($_SERVER['HTTP_HOST'])
? $_SERVER['HTTP_HOST']
: (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost');
// Remove port from HTTP_HOST generated $environment
$environment = strtolower(Utils::substrToString($environment, ':'));
$folder = "sites/{$environment}";
$themes = ["user/themes"];
if (is_dir(__DIR__ . "/user/{$folder}/themes")) {
array_unshift($themes, "user/{$folder}/themes");
}
$plugins = ["user/plugins"];
if (is_dir(__DIR__ . "/user/{$folder}/plugins")) {
array_unshift($plugins, "user/{$folder}/plugins");
}
if ($environment === 'localhost' || !is_dir(ROOT_DIR . "user/{$folder}")) {
return [];
}
return [
'environment' => $environment,
'streams' => [
'schemes' => [
'user' => [
'type' => 'ReadOnlyStream',
'prefixes' => [
'' => ["user/{$folder}"],
]
],
'environment' => [
'type' => 'ReadOnlyStream',
'prefixes' => [
'' => ["user/{$folder}"],
]
],
'themes' => [
'type' => 'ReadOnlyStream',
'prefixes' => [
'' => $themes
]
],
'plugins' => [
'type' => 'ReadOnlyStream',
'prefixes' => [
'' => $plugins
]
],
'plugin' => [
'type' => 'ReadOnlyStream',
'prefixes' => [
'' => ['plugins://']
]
]
]
]
];
Please HEEELP! 😦
