- Go to
Admin > Stores > All Stores
- Click >
Create Web Site
- In the Name field, enter store name.
- e.g.
Japan
- e.g.
- In the Code field, enter a unique string without spaces and >
Save Web Site
- e.g.
super_jp
- e.g.
- Create Store
- Create Store View
- Go to
Stores > Configuration
- Select the website we just created.
- Go to Web & change both Base URLs & Base URLs (Secure)
- e.g.
Base URL: http://example.com/
Base Link URL: {{unsecure_base_url}}jp/
- ... same goes for Base URLs (Secure)
- e.g.
- Save. Clear Cache. Reindex.
-
Create a subfolder with the desired name.
- e.g.
/jp/
- e.g.
-
Copy
index.php & .htaccess
from root (!important copy both files) -
Open
index.php
clear everything inside it and paste:require realpath(__DIR__) . '/../app/bootstrap.php'; $params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'super_jp'; // change this with the code you chose in step. 4 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website'; // store or website $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params); $app = $bootstrap->createApplication('Magento\Framework\App\Http'); $bootstrap->run($app);
-
Save. Clear Cache. Reindex.
-
Enjoy your new website inside a subdir.
I am here to ask for help, I can share customers between two websites using customer sharing as global. do you have any idea how can I share shopping cart between two websites? I followed the steps you mentioned above and created multi site with websites. any help would be much appreciated. I am very new to magento2. I read here we have to share SID session between two stores, but not sure how to do it.
https://magento.stackexchange.com/questions/3617/sharing-sessions-between-stores-with-different-domains/3624#3624
I tried this $_COOKIE['website'] = $_SERVER['MAGE_RUN_CODE']; putting in my index.php of new website but did not work for me. any help or new article will be much appreciated. there is no article for magneto2 for sharing shopping cart between multi site out there.
Thank you so much for your time.