Magento2.1: How to create multiple websites with different domainsMagento2: How to create multiple storefrontsSharing Sessions Between Stores with Different DomainsMultiple stores, dynamic domains problemHow to create Multiple Store with different domain in MagentoMagento 1.9 multiple websites on different domainsHow to merge different magento installed websites to one installation as multiple storeSingle webstore with multiple fullfilment locationsMulti store with different domains, cookie store is causing problemHow to switch the main domain on multi-website Magento 2.1.0 installation?How to configure Magento 2 multiple websites on AWS EC2
Setting MAC field to all-zero to indicate unencrypted data
What would be the ideal melee weapon made of "Phase Metal"?
What is this welding tool I found in my attic?
Novel where a group of scientists in a spaceship encounter various aliens
Keep milk (or milk alternative) for a day without a fridge
If the railway suggests a 5-min connection window for changing trains in the Netherlands, does that mean it's definitely doable?
Flatten array with OPENJSON: OPENJSON on a value that may not be an array? [ [1] ], vs [1]
Was I subtly told to resign?
Should disabled buttons give feedback when clicked?
How can one write good dialogue in a story without sounding wooden?
Referring to different instances of the same character in time travel
Shortest distance around a pyramid?
Why isn't there research to build a standard lunar, or Martian mobility platform?
Why do players in the past play much longer tournaments than today's top players?
Did any of the founding fathers anticipate Lysander Spooner's criticism of the constitution?
CentOS 7 -> find: missing Argument for "-exec"
Is there a word for a message that is intended to be intercepted by an adversary?
What explains 9 speed cassettes price differences?
How is angular momentum conserved for the orbiting body if the centripetal force disappears?
Why were Er and Onan punished if they were under 20?
What is the best way to stacked subscripts for a matrix?
references on the empirical study on the practice of OR
How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?
How were Martello towers supposed to work?
Magento2.1: How to create multiple websites with different domains
Magento2: How to create multiple storefrontsSharing Sessions Between Stores with Different DomainsMultiple stores, dynamic domains problemHow to create Multiple Store with different domain in MagentoMagento 1.9 multiple websites on different domainsHow to merge different magento installed websites to one installation as multiple storeSingle webstore with multiple fullfilment locationsMulti store with different domains, cookie store is causing problemHow to switch the main domain on multi-website Magento 2.1.0 installation?How to configure Magento 2 multiple websites on AWS EC2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I deployed Magento 2.1 on console.google
Is there anybody who succeded to deploy multiple websites with different domains?
Magento2: How to create multiple storefronts
does not works for Magento 2.1
I am sure many people suffer the same issue?
There is not any answer to similar question for Magento 2.1 on link
How to setup another domain/website on the same Magento 2.1.0 installation? (updated)
magento2 multistore multidomain cloud
add a comment |
I deployed Magento 2.1 on console.google
Is there anybody who succeded to deploy multiple websites with different domains?
Magento2: How to create multiple storefronts
does not works for Magento 2.1
I am sure many people suffer the same issue?
There is not any answer to similar question for Magento 2.1 on link
How to setup another domain/website on the same Magento 2.1.0 installation? (updated)
magento2 multistore multidomain cloud
add a comment |
I deployed Magento 2.1 on console.google
Is there anybody who succeded to deploy multiple websites with different domains?
Magento2: How to create multiple storefronts
does not works for Magento 2.1
I am sure many people suffer the same issue?
There is not any answer to similar question for Magento 2.1 on link
How to setup another domain/website on the same Magento 2.1.0 installation? (updated)
magento2 multistore multidomain cloud
I deployed Magento 2.1 on console.google
Is there anybody who succeded to deploy multiple websites with different domains?
Magento2: How to create multiple storefronts
does not works for Magento 2.1
I am sure many people suffer the same issue?
There is not any answer to similar question for Magento 2.1 on link
How to setup another domain/website on the same Magento 2.1.0 installation? (updated)
magento2 multistore multidomain cloud
magento2 multistore multidomain cloud
edited Apr 13 '17 at 12:55
Community♦
1
1
asked Oct 6 '16 at 12:33
CengizCokayCengizCokay
12 bronze badges
12 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I got it:
In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
$params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
/** @var MagentoFrameworkAppHttp $app */
$app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
$bootstrap->run($app);
The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:
ln -s /path/to/your/install/public_html/m2/app/ app
ln -s /path/to/your/install/public_html/m2/lib/ lib
ln -s /path/to/your/install/public_html/m2/pub/ pub
ln -s /path/to/your/install/public_html/m2/var/ var
After we added the latter, everything seems to work fine, so far.
Good luck!
add a comment |
You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.
Step 1: Point all domains to pub
in Magento's root directory
Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.
Step 3: Set store or website for each domain as environment variable in .htaccess
of pub
directory or in the webserver configuration.
Example with the websites as given in the question:
SetEnv MAGE_RUN_TYPE website
SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2Example with store views instead of websites
SetEnv MAGE_RUN_TYPE store
SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace
abc.com
with^abc.com$
Step 4: Clear cache and access your domains.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139687%2fmagento2-1-how-to-create-multiple-websites-with-different-domains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I got it:
In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
$params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
/** @var MagentoFrameworkAppHttp $app */
$app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
$bootstrap->run($app);
The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:
ln -s /path/to/your/install/public_html/m2/app/ app
ln -s /path/to/your/install/public_html/m2/lib/ lib
ln -s /path/to/your/install/public_html/m2/pub/ pub
ln -s /path/to/your/install/public_html/m2/var/ var
After we added the latter, everything seems to work fine, so far.
Good luck!
add a comment |
I got it:
In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
$params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
/** @var MagentoFrameworkAppHttp $app */
$app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
$bootstrap->run($app);
The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:
ln -s /path/to/your/install/public_html/m2/app/ app
ln -s /path/to/your/install/public_html/m2/lib/ lib
ln -s /path/to/your/install/public_html/m2/pub/ pub
ln -s /path/to/your/install/public_html/m2/var/ var
After we added the latter, everything seems to work fine, so far.
Good luck!
add a comment |
I got it:
In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
$params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
/** @var MagentoFrameworkAppHttp $app */
$app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
$bootstrap->run($app);
The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:
ln -s /path/to/your/install/public_html/m2/app/ app
ln -s /path/to/your/install/public_html/m2/lib/ lib
ln -s /path/to/your/install/public_html/m2/pub/ pub
ln -s /path/to/your/install/public_html/m2/var/ var
After we added the latter, everything seems to work fine, so far.
Good luck!
I got it:
In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
$params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
/** @var MagentoFrameworkAppHttp $app */
$app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
$bootstrap->run($app);
The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:
ln -s /path/to/your/install/public_html/m2/app/ app
ln -s /path/to/your/install/public_html/m2/lib/ lib
ln -s /path/to/your/install/public_html/m2/pub/ pub
ln -s /path/to/your/install/public_html/m2/var/ var
After we added the latter, everything seems to work fine, so far.
Good luck!
answered May 17 '17 at 14:40
Kim K.Kim K.
337 bronze badges
337 bronze badges
add a comment |
add a comment |
You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.
Step 1: Point all domains to pub
in Magento's root directory
Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.
Step 3: Set store or website for each domain as environment variable in .htaccess
of pub
directory or in the webserver configuration.
Example with the websites as given in the question:
SetEnv MAGE_RUN_TYPE website
SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2Example with store views instead of websites
SetEnv MAGE_RUN_TYPE store
SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace
abc.com
with^abc.com$
Step 4: Clear cache and access your domains.
add a comment |
You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.
Step 1: Point all domains to pub
in Magento's root directory
Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.
Step 3: Set store or website for each domain as environment variable in .htaccess
of pub
directory or in the webserver configuration.
Example with the websites as given in the question:
SetEnv MAGE_RUN_TYPE website
SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2Example with store views instead of websites
SetEnv MAGE_RUN_TYPE store
SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace
abc.com
with^abc.com$
Step 4: Clear cache and access your domains.
add a comment |
You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.
Step 1: Point all domains to pub
in Magento's root directory
Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.
Step 3: Set store or website for each domain as environment variable in .htaccess
of pub
directory or in the webserver configuration.
Example with the websites as given in the question:
SetEnv MAGE_RUN_TYPE website
SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2Example with store views instead of websites
SetEnv MAGE_RUN_TYPE store
SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace
abc.com
with^abc.com$
Step 4: Clear cache and access your domains.
You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.
Step 1: Point all domains to pub
in Magento's root directory
Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.
Step 3: Set store or website for each domain as environment variable in .htaccess
of pub
directory or in the webserver configuration.
Example with the websites as given in the question:
SetEnv MAGE_RUN_TYPE website
SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2Example with store views instead of websites
SetEnv MAGE_RUN_TYPE store
SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace
abc.com
with^abc.com$
Step 4: Clear cache and access your domains.
answered Jul 3 at 21:44
Aman SrivastavaAman Srivastava
9676 silver badges15 bronze badges
9676 silver badges15 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139687%2fmagento2-1-how-to-create-multiple-websites-with-different-domains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown