Skip to main content
🎁 Exclusive Launch Deal: Premium Themes Available FREE — Grab Yours Now!
Back to Blog
General

How to Setup Multiple Websites with Multiple Domain in Magento2

admin 1 min readPublished Jun 11, 2016Updated Jul 22, 2026
How to Setup Multiple Websites with Multiple Domain in Magento2

Multi-website architecture in Magento 2

Magento supports hierarchy: Website → Store → Store View. Use multiple websites when brands, catalogs, currencies, or customer bases must stay separated while sharing one Magento instance.

1) Create websites and stores in Admin

  1. Go to Stores → All Stores.
  2. Create a Website (for example, brand_a).
  3. Create a Store under that website.
  4. Create Store Views for languages/locales.

2) Configure base URLs per website

  1. Switch scope to the target website.
  2. Open Stores → Configuration → General → Web.
  3. Uncheck “Use Default” for Base URL and Base Link URL.
  4. Set HTTPS URLs for each domain (example: https://brand-a.com/).

3) Map domains in server / cloud

Point each domain’s DNS A/CNAME records to your Magento host. Configure the web server (Nginx/Apache) or cloud platform so all domains serve the same Magento docroot. Magento then resolves the correct website via base URL matching.

4) Website discrimination

Ensure $_SERVER['HTTP_HOST'] matches configured base URLs. For local testing, add hosts-file entries. In production, force HTTPS and consistent www/apex redirects before Magento boots.

5) Catalog, customers, and checkout scope

  • Share or separate catalogs per website based on business rules.
  • Customer accounts can be shared globally or limited per website.
  • Payment/shipping methods can be enabled per website scope.

Cookies and sessions

Set cookie domains carefully. Overly broad cookies can leak sessions across brands; overly narrow cookies break login. Test login, cart, and checkout on each domain after configuration.

Verification checklist

  1. Each domain loads the correct theme/locale.
  2. Product visibility matches website assignment.
  3. Checkout completes on every domain.
  4. Sitemaps and base URLs generate per store view as expected.