1

Locally I have setup two themes.

Theme Directories
app/design/frontend/VendorParent/default   //Inherits from Luma
app/design/frontend/VendorChild/default    //Inherits from VendorParent

On the admin side under Content -> Configuration, I have two websites setup.

Main Website      //Uses VendorParent theme
Another Website   //User VendorChild theme

Under my etc/hosts file I have added entries for both of these sites. I have also added these to the apache vhost file and pointed them both to the same location (magento folder)

127.0.0.1 mainsite.magento.dev
127.0.0.1 anothersite.magento.dev

I went under stores -> configuration -> general -> web. Here I turned off the 'Auto-redirect to Base URL' option for the default site. Then I went into the same place for the anothersite and changed the 'Base URL' and 'Base Link URL' to be anothersite.magento.dev (I also did this for secure urls here).

I can hit both urls properly, however when I go to anothersite.magento.dev, it is trying to load css files for the mainsite.magento.dev, and I am getting a bunch of font CORS errors in the console. here are the paths it is trying to load for the css.

mainsite.magento.com/pub/static/version1498747501/frontend/Main/default/en_US/mage
mainsite.magento.com/pub/static/version1498747501/frontend/Main/default/en_US/css
mainsite.magento.com/pub/static/version1498747501/frontend/Main/default/en_US/Main/css
mainsite.magento.com/pub/static/version1498747501/frontend/Main/default/en_US/css
mainsite.magento.com/pub/media
mainsite.magento.com/pub/static/version1498747501/frontend/Main/default/en_US/css

And here are the font CORS error paths.

Access to Font at 'http://mainsite.magento.dev/pub/static/version1498747501/frontend/Main/default/en_US/fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff2' from origin 'http://anothersite.magento.dev' has been blocked by CORS policy
Access to Font at 'http://mainsite.magento.dev/pub/static/version1498747501/frontend/Main/default/en_US/fonts/Another/Another-Regular.woff' from origin 'http://anothersite.magento.dev' has been blocked by CORS policy:
Access to Font at 'http://mainsite.magento.dev/pub/static/version1498747501/frontend/Main/default/en_US/fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff' from origin 'http://anothersite.magento.dev' has been blocked by CORS policy:
Access to Font at 'http://mainsite.magento.dev/pub/static/version1498747501/frontend/Main/default/en_US/fonts/Another/Another-Regular.ttf' from origin 'http://anothersite.magento.dev' has been blocked by CORS policy:

Actually now that I look at it, it is using the mainsite url for all assets being loaded on the anothersite url.

0

Figured it out. I missed the section in the setup where I needed to add the SetEnv to my apache vhost file. After adding this it works! The reference is here.

SetEnv MAGE_RUN_CODE "german"
SetEnv MAGE_RUN_TYPE "website"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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