1

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

Replaced:

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

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

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

$bootstrap->run($app);

With:

$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');

 $bootstrap->run($app);
  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.

Teja Bhagavan Kollepara
  • 3,816
  • 5
  • 32
  • 69
  • 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.

    https://magento.stackexchange.com/questions/94855/create-multi-website-stores-in-magento-2

    – Gagan Jul 24 '18 at 05:33
  • Can we work without creating new folders like as axample you'he told?@LAW – Teja Bhagavan Kollepara Jul 24 '18 at 06:00
  • You can use server to point the domain, and set domain using index.php on root – Gagan Jul 24 '18 at 06:09
  • @LAW, I have pointed the domain. please check once my updated description – Teja Bhagavan Kollepara Jul 24 '18 at 09: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
  • @TejaBhagavanKollepara Any help with the same thread Multi_website https://magento.stackexchange.com/q/315027/57334 Thanks – zus Jun 27 '20 at 11:11
  • Its works for me thank you so much. – santosh Feb 10 '21 at 06:52

1 Answers1

-1

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.

Teja Bhagavan Kollepara
  • 3,816
  • 5
  • 32
  • 69
Siju Joseph
  • 815
  • 8
  • 6
  • 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. – Siju Joseph Jul 25 '18 at 12:04