1

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: configuration of store views

I setup the Url Options for the Default Config view: main store url options

======================================================
I setup the Url Options for the Leisnoi Company Store English view: subdomain url options

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?

0

Please change that stores Base URLs from http://akcustom.ink/ to http://leisnoi.akcustom.ink/ and also change Base URLs (Secure)

enter image description here

Hope this will help you!

|improve this answer|||||
0

I think you should set the Base URL's on the Website level not Store View. Step 5 on this link.

Go to your Leisnoi Company Store website config, it might still be using the Default Config URLs.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.