I have the fallowing domains:
www.test1.mydomain1.com
www.test2.mydomain2.com
I've created the websites and the stores that are attached to them. From the admin panel I changed the Base URL and Base URL Link of website1 to
http://test1.mydomain1.com
And for website2 to
http://test2.mydomain2.com
In pub/index.php I added the fallowing
$test1 = array('test1.mydomain1.com');
$test2 = array('test2.mydomain2.com');
if(in_array($params['SERVER_NAME'],$test1)){
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website1';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
}
else if(in_array($params['SERVER_NAME'],$test2 )){
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
}
Still, when I go to www.test1.mydomain1.com everything is broken. The CSS and javascript files are not loaded apparently, and the console in dev tools shows errors like:
GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/animate.css
(index):18 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/styles-m.css
(index):21 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/owl.carousel/assets/owl.carousel.css
(index):20 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/bootstrap/css/bootstrap-theme.css
(index):17 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/mage/calendar.css
(index):19 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/bootstrap/css/bootstrap.css
(index):24 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/icon-fonts/css/porto-icons-codes.css
(index):25 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/icon-fonts/css/animation.css
(index):27 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/Smartwave_Filterproducts/css/filterproducts.css
(index):23 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/fancybox/css/jquery.fancybox.css
(index):26 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/custom.css
(index):28 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/styles-l.css
(index):131 GET http://test1.mydomain1.com/media/porto/configed_css/design_mshop_swe.css
(index):132 GET http://test1.mydomain1.com/media/porto/configed_css/settings_mshop_swe.css
(index):30 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/requirejs/require.js
(index):31 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/mage/requirejs/mixins.js
requirejs-config.js:18 Uncaught TypeError: require.config is not a function(anonymous function) @ requirejs-config.js:18(anonymous function) @ requirejs-config.js:19(anonymous function) @ requirejs-config.js:601
(index):34 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/bootstrap/js/bootstrap.min.js
(index):35 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/fancybox/js/jquery.fancybox.js
(index):33 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/jquery.js
(index):42 Uncaught TypeError: require is not a function(anonymous function) @ (index):42
(index):134 Uncaught TypeError: require is not a function(anonymous function) @ (index):134
(index):143 Uncaught TypeError: require.config is not a function(anonymous function) @ (index):143
(index):362 Uncaught TypeError: require is not a function(anonymous function) @ (index):362
(index):348 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/images/logo.svg 404 (Not Found)
(index):29 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/print.css
What am I missing ?