cancel
Showing results for 
Search instead for 
Did you mean: 

Second store, htaccess file confusion

Second store, htaccess file confusion

Apologies for what is probably a simple question.

So i am creating a second store front using a second domain. Magento is set, but i need to configure the .htaccess file and the index.php file to allow for a shared directory. But i am confused as to what is needed. 

When i google the way to do this, there are plenty of responses but they don't seem to match what i currently see in the files, so i'm unclear what i am adding and where.

For example, i think i am meant to be editing the index file to add:

<?php
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'yourcode.yourdomain.com';
$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);
?>

But, i'm unclear as to where this code goes inside the file.

And the htaccess code should be added after “RewriteBase /magento/”:

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

But, my htaccess doesnt have that line to put it after:

############################################
## you can put here your magento root folder
## path relative to web root

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>

 

As a side note, the website/store view name is "ADHD" (code "second") 

Any help offered would be appreciated.