I am working on Magento-2.2.4.

So, my url is as follows : http://puppetkart.com/ and on Luma theme.

My requirement is as follows :

  1. I have created second website and store and store view for this newly created website in admin panel. My new website is http://vizag.puppetkart.com/ And added this url at Base url section for this new website.

  2. I have created sub domain and managed the DNS also. Edited the index.php which is in new folder


$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);

/** @var \Magento\Framework\App\Http $app */

$app = $bootstrap->createApplication('Magento\Framework\App\Http');



$params = $_SERVER;

 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'vizag'; //Webite code as same in admin panel

 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';

 $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

 /** @var \Magento\Framework\App\Http $app */

 $app = $bootstrap->createApplication('Magento\Framework\App\Http');

  1. When i open my new website http://vizag.puppetkart.com/, CSS and js are not calling properly.

Can anyone please guide me to create multi websites.

  • You can use the sub directory method. Like hy forhyderabad, and in their use the htaccess, index.php and symlinks to root for other directories. magento.stackexchange.com/questions/94855/…
    – Gagan
    Jul 24 '18 at 5:33
  • Can we work without creating new folders like as axample you'he told?@LAW Jul 24 '18 at 6:00
  • You can use server to point the domain, and set domain using index.php on root
    – Gagan
    Jul 24 '18 at 6:09
  • @LAW, I have pointed the domain. please check once my updated description Jul 24 '18 at 9:46
  • Seems like correct, try to clear cache, and clear static content. If still not solved, shared the url which is getting formed in sub-domain for css files
    – Gagan
    Jul 24 '18 at 11:47

Can you try updating the following fields with that of your main domain? under

Stores->Configuration->General->Web-><your new store>

Secure Base URL for Static View Files (eg: (http://yourmaindomain.com/static/)

Secure Base URL for User Media Files (http://yourmaindomain.com/media/)

Because your media is now trying to fetch from a directory (pub/static) that is relative to your new base url which does not exist. If you ask Magento to fetch your media and static files (css/JS) from parent site it should work.

Try this and confirm (in view source) from where the media/static resources are fetching.

  • You should have set that in the store scope. Now you have to delete that entry from core_config_data to get the admin interface back normal. And then switch to the store you want to get the change affected and update the urls. Jul 25 '18 at 12:04

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.