cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Asset Loading in multistore environment

Magento 2 Asset Loading in multistore environment

I have currently have Magento 2 setup with 5 different stores, the default store "example.eu" works fine.

When visiting the frontend of the 4 other stores, i.e "example.uk", all the pages assets are loaded from the .eu domain. In addition several assets, html & json files, fail to load on the non default sites with a "405 Not Allowed"

Is the loading of assets from the default domain correct? (I am assuming not) And why would some of the assets fail to load?

4 REPLIES 4

Re: Magento 2 Asset Loading in multistore environment

Hello @sam_taylor 

 

Please follow the post "How to Setup Magento 2 Multi Store"

Step 9 will be helpful to you.

Thanks.

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"

Re: Magento 2 Asset Loading in multistore environment

@Meetanshi 

Surely you can use the same webroot for all of your stores?

creating new webroots and symlinking everything seems redundant.

Re: Magento 2 Asset Loading in multistore environment

Hey, @sam_taylor again!

Yes, you can use the same webroot for all of your stores’ CSS, JS, and Images.
For that, you can set your default store’s path in “Base URL for Static View Files” and “Base URL for User Media Files” configurations from “Stores → Configuration → Web → Base URLs”.

 

Thanks

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"

Re: Magento 2 Asset Loading in multistore environment

@MeetanshiI already had both "Base URL for Static View Files" and "Base URL for User Media Files" set for each stores config and it is still loading from default domain