Created
September 6, 2025 19:45
-
-
Save ceaksan/86e45bf14674920707a0c8be10169e25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Multisite setup for subsites accessible via sub-domains. | |
* | |
* DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING! | |
*/ | |
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}"; | |
if ($environment === 'localhost' || !is_dir(ROOT_DIR . "user/{$folder}")) { | |
return []; | |
} | |
return [ | |
'environment' => $environment, | |
'streams' => [ | |
'schemes' => [ | |
'user' => [ | |
'type' => 'ReadOnlyStream', | |
'prefixes' => [ | |
'' => ["user/{$folder}"], | |
] | |
] | |
] | |
] | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment