0

I am trying to run two Magento stores via same admin panel i have a magento installed at domain name/magento now as a first step i have go catalog->Manage Category and add two different root category for two different store and set Is Anchor to yesand Is Active to yes now i go to sytem->Manage Store and make other store name magento2 now i go to folder where my magento is installed and make the a folder name magento2 then copy the .htacess and index.phpfrom root folder to magento2 folder then edit the .htacces and index.php file then I have replace the following code

"$mageFilename = ‘app/Mage.php’;" with $mageFilename = ‘../app/Mage.php’; and in .htaccess file add the following line at the bottom SetEnvIf Host .*base.* MAGE_RUN_CODE="base"; SetEnvIf Host .*magento_site_2.* MAGE_RUN_TYPE="magento2";

now i go to system->configuration and the store view to magento2 then i go to genral->web and in base link url option under secure and unsecure tab add the following code

{{unsecure_base_url}}magento2/ 

when i open the url www.mydomain.com/magento/magento2/ then page is displaying only blank page and also www.mydomain.com/magento url not working properly. Products and categories page are not working. That pages are giving error page not found. What should I do now? Any help or suggestions please give.

how to create different store view on same domain magento?

thank you.

2 Answers 2

1

You can try with below steps. It worked for me.

Setp 1

i) Create folder MAGE_ROOT/magento2/

ii) Copy your magento root index.php and .htaccess

Setp 2

i) Open index.php, find below line and replace your_store_code with store code

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'your_store_code'; $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

ii) Open .htaccess files and give your folder path

RewriteBase /magento2/

Step 3

i) Go to System->Configuration then select store view and General->Web

ii) Under Unsecure and Secure Base URL http://yourdomain/magento2/

iii) If ii(setp 3) don't load styles, js and media files, please set yourdomain_link/skin/, yourdomain_link/media/ and yourdomain_link/js/

Hope it will help you. Best of luck!

2
  • how to set media and js files.. is there any code for that and where to add code for that?
    – Nidhi
    Commented Apr 14, 2015 at 3:08
  • You can set from System->Configuration->(Select Your Store)->General->Web Skin: http://yourdomain.com/skin, JS: http://yourdomain.com/js, Media: http://yourdomain.com/media Commented Apr 15, 2015 at 5:19
0

Update:

Version Magento 2.3.4

Setp 1

  1. Create folder MAGE_ROOT/gcentric/
  2. Copy your magento root index.php and .htaccess

Setp 2

  1. Open index.php. Copy the following lines from comments:

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

Search for the following code snippet and paste above lines before this:

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

Replace string values 'website2' and 'website' with new store code 'gcentric'.

  1. Now, open the .htaccess file in MAGE_ROOT/gcentric/ and add new folder path

RewriteBase /gcentric/

Step 3

  1. Go to Stores -> Settings -> Configuration.
  2. Change 'Scope' to 'Default Config'.
  3. In URL Options, set 'Add Store Code to Urls' to Yes.
  4. Change 'Scope' to 'Gcentric'. Update the Base URLs from 'Default Pages' to newly created store.

Step 4 Since, we are creating multiple stores on the same domain. Therefore, styles, JS, media and skins should work correctly.

Assumption: There is a sub-store created in the existing domain with Store name 'Gcentric.com' and Store code 'gcentric'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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