1

How can i get different domains name for different stores created. Created store name as French its domain name should be fr.domainname.com.Thanks in advance..

10
  • Do you want multiple websites in Magento 2 ? Oct 2, 2018 at 11:20
  • Yeah i have multiple country so i need multiple websites as in format fr.domainname.com for french store Aditya Shah Oct 2, 2018 at 11:21
  • Okay sharing a solution. Oct 2, 2018 at 11:22
  • Please check my answer. Oct 2, 2018 at 11:34
  • let me know if you have any query Oct 2, 2018 at 11:40

1 Answer 1

4

Step 1: Create websites


  1. In your Magento backend, go to

Stores > Settings > All Stores

enter image description here

  1. On the Stores page, click Create Website.

enter image description here

  • Name: Enter a name to identify the website.
  • Code: Enter a unique code; for example, if you have a French store, you can enter
  • french
  • Sort Order: Enter an optional numerical sort order.

  1. Click Save Web Site.

  2. Repeat these tasks as many times as necessary to create your websites.


Step 2: Create stores

  • In your Magento backend, go to Stores > Settings > All Stores.
  • On the Stores page, click Create Store. enter image description here

Web Site: Select the website with which to associate this store. Name: Enter a name to identify the store. Root Category: Select the root category for this store.On the Stores page, click Create Store.

  • Click Save Store.
  • Repeat these tasks as many times as necessary to create your stores.

Step 3: Create store views


  • In your Magento backend, go to Stores > Settings > All Stores.
  • On the Stores page, click Create Store View. enter image description here

Store: Select the store with which to associate this store view.

Name: Enter a name to identify this store view.

Code: Enter a unique name to identify this store view.

Status: Select Enabled.

Sort Order: Enter an optional numerical sort order.

  • Click Save Store View.

  • Repeat these tasks as many times as necessary to create your store views.


Step 4: Change the website’s base URL

  • In your Magento backend, go to Stores > Settings > Configuration. Under General section, click Web.

  • From the Store View list at the top of the page, select a website.

  • Expand Base URLs section.

enter image description here


Step 5: Add the store code to the base URL

Magento gives you the option to add the store code to the site’s base URL, which simplifies the process of setting up multiple stores. Using this option, you don’t have to create directories on the Magento file system to store index.php and .htaccess.

This prevents index.php and .htaccess from getting out of sync with the Magento codebase in future upgrades.

  • In your Magento backend, go to Stores > Settings > Configuration. Under General section, click Web.
  • From the Store View list at the top of the page, select Default Config.
  • Expand Url Options section.

enter image description here

  • Uncheck the Use system value box next to Add Store Code to Urls. Then set this to Yes.
  • Click Save Config.
  • If prompted, flush the Magento cache. (System > Cache Management).

Step 6: Change the default store view’s base URL

You must perform this step last because after it’s done, you’ll lose access to the Magento Admin; your access returns after you set up virtual hosts as discussed in the web-server-specific topics.

  • In your Magento backend, go to Stores > Settings > Configuration. Under General section, click Web.
  • From the Store View list at the top of the page, select Default Config. Expand Base URLs section.
  • Enter your website’s base URL. For example: https://www.example.com/ Click Save Config.

Step 7: It’s done! You have successfully set up multiple websites and stores in Magento 2

3
  • Hi Aditya Shah i have given base url french.localhost/magento but it redirecting to admin panel Oct 2, 2018 at 11:50
  • please remove the cache Oct 2, 2018 at 11:57
  • @RohanHapani is there any way to use 2 different domains by using 1 magento backend ex - www.abc.com. www.xyz.com using 1 magento 2 backend)
    – Mujahidh
    Aug 18, 2021 at 14:55

Your Answer

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

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