3

I tried these steps, but nothing happened. I got 500 internal server error https://www.cloudways.com/blog/create-and-configure-multistore-magento-2/

I have 3 domains.

The main is beste.nl. The others are fejie.nl and pacats.nl.

Codes:

beste.nl = beste
fejie.nl = fejie
pacats.nl = pacats

I just copied the index.php of beste.nl and pasted into fejie.nl, and using this following code:

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'fejie';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app)

I just copied the .htaccess of beste.nl and pasted into fejie.nl, and using this following code:

RewriteCond %{HTTP_HOST} ^(.)fejie.nl
RewriteRule .
– [E=MAGE_RUN_CODE:fejie]
RewriteCond %{HTTP_HOST} ^(.)fejie.nl
RewriteRule .
– [E=MAGE_RUN_TYPE:website

1 Answer 1

0

Adjusting the .htaccess should be sufficient with Magento 2. No need to update the index.php. In the .htaccess file make sure to add

SetEnvIf Host .*example.com.* MAGE_RUN_CODE=yourcode.yourdomain.com
SetEnvIf Host .*example.com.* MAGE_RUN_TYPE=website

And

RewriteCond %{HTTP_HOST} ^(.*)example\.com
RewriteRule .* – [E=MAGE_RUN_CODE:frenchsite.example.com]
RewriteCond %{HTTP_HOST} ^(.*)example\.com
RewriteRule .* – [E=MAGE_RUN_TYPE:website]

Do not forget the backslash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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