I have a Magento 2.3.3 install at akcustom.ink. I have configured a new subdomain in my cpanel for leisnoi.akcustom.ink. My problem is that when I navigate to leisnoi.akcustom.ink in a browser it redirects me to akcustom.ink. I know the subdomain works right because I uploaded a test.php file in the root folder of the subdomain and could access it fine in a browser. Below are the steps I have taken to configure this sub store.
I have configured the different store views:
I setup the Url Options for the Default Config
view:
======================================================
I setup the Url Options for the Leisnoi Company Store English
view:
I have added the following to my .htaccess file in the root folder of the main site:
SetEnvIf Host www.akcustom.ink MAGE_RUN_CODE='base'
SetEnvIf Host www.akcustom.ink MAGE_RUN_TYPE='website'
SetEnvIf Host leisnoi.akcustom.ink MAGE_RUN_CODE='LEICS_en'
SetEnvIf Host leisnoi.akcustom.ink MAGE_RUN_TYPE='store'
I have copied the index.php and .htaccess files from the main website to the subdomain folder. In the index.php file of the subdomain I have removed this block of code:
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);
and replaced it with this:
$params = $_SERVER;
$domain2store = array(
'leisnoi.akcustom.ink'=>'LEICS_en',
'upperonestudios.akcustom.ink'=>'UOSCS_en',
'denalimontessori.akcustom.ink'=>'DMSS_en',
);
if(isset($domain2store[$_SERVER['HTTP_HOST']])){
$storecode = $domain2store[$_SERVER['HTTP_HOST']];
}
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = isset($storecode) ? $storecode : '';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('\Magento\Framework\App\Http');
$bootstrap->run($app);
Finally, I created symlinks in my subdomain root folder via SSH as follows:
ln -s /home/username/akcustom.ink/app/ app
ln -s /home/username/akcustom.ink/lib/ lib
ln -s /home/username/akcustom.ink/pub/ pub
ln -s /home/username/akcustom.ink/var/ var
Where you see username
above I put my actual username.
After all of this, it still redirects to the main site. I have tried every possible solution that I have found and none have done the trick. What am I doing wrong?