forked from magento/magento-cloud
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmagento-vars.php
38 lines (35 loc) · 976 Bytes
/
magento-vars.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Enable, adjust and copy this code for each store you run
*
* Store #0, default one
*
* if (isHttpHost("example.com")) {
* $_SERVER["MAGE_RUN_CODE"] = "default";
* $_SERVER["MAGE_RUN_TYPE"] = "store";
* }
*
* @param string $host
* @return bool
*/
function isHttpHost(string $host)
{
if (!isset($_SERVER['HTTP_HOST'])) {
return false;
}
return $_SERVER['HTTP_HOST'] === $host;
}
$allowedSiteCodes = ['fresh','auto','b2b','b2c','sitea','siteb','sitec','sited','sitee','luma','venia','brentmill','healthbeauty','wknd','wecafe','bodea','frescopa'];
if(isset($_SERVER['REQUEST_URI'])){
$uri = explode('/', $_SERVER['REQUEST_URI']);
if(isset($uri[1])){
if (in_array($uri[1], $allowedSiteCodes)) {
$_SERVER["MAGE_RUN_TYPE"] = 'website';
$_SERVER["MAGE_RUN_CODE"] = $uri[1];
}
}
}