Skip to content

Magento2 multiwebsite multistore sharing storeview code

We have a Magento 2.4 project with multiple websites with multiple stores & we need to share some store codes for store views. All store views should load under same domain

Document root of this project is pointing to magento/pub folder, as recommended

URL structure should be a bit different than usual

I’ll try to explain using some concrete url strings, so answers can use them, for clarity

Website1 (es)
------------- Store1 -------- Storeview (hair)
              Store2 -------- Storeview (pets)
Website2 (fr)
------------- Store1 -------- Storeview (hair)
              Store2 -------- Storeview (pets)

They should run under this urls

www.domain.com/es/hair/ 
www.domain.com/es/pets/
www.domain.com/fr/hair/
www.domain.com/fr/pets/

How can we achieve this?

Using nginx configuration would NOT be the desired way. We’d like to follow some approach like this using folders but we’ve tried with no success, so I open this question to try understanding this better. Please use the provided concrete urls in your answers so we can try. Apart from the filesystem changes I need to know too the required configuration changes in admin

I’ll give 500 points of reputation for the answer which make this work 🙂