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
- Go to Stores → All Stores.
- Create a Website (for example,
brand_a). - Create a Store under that website.
- Create Store Views for languages/locales.
2) Configure base URLs per website
- Switch scope to the target website.
- Open Stores → Configuration → General → Web.
- Uncheck “Use Default” for Base URL and Base Link URL.
- 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
- Each domain loads the correct theme/locale.
- Product visibility matches website assignment.
- Checkout completes on every domain.
- Sitemaps and base URLs generate per store view as expected.



